What result AJAX edit expectes?

What result AJAX edit expectes?

JaakkoJaakko Posts: 4Questions: 2Answers: 0
edited April 2018 in Editor

Hello,

I have set AJAX function inside the editor options like this

 ajax: {
          edit: {
                    type: 'POST',
                    url:  functionsPath,                    
                    data: function(d) {                                                                        
                        var newdata;
                            $.each(d.data, function (key, value) {                                
                                newdata = value;
                                newdata.order_id = key;
                        });                        
                        newdata.action = "updateOrderDetails";                                                                                                                    
                        return newdata;
                    }
          },
 } 

Then I'll use PHP to update MySQL table.

$updateDetails = $db->prepare("UPDATE orders_data SET ...")

Everything seems to be that are working, but I am getting this one error everything nevertheless when everything is working.

A system error has occurred (More information).

Console is quiet aswell as Network tab.

Answers

  • JaakkoJaakko Posts: 4Questions: 2Answers: 0

    Okay I got it.

    On create: Data of the added / edited row(s)
    On edit: Data of the added / edited row(s)
    On remove: Not used / not required

    So when I edit row I need to return new row data back.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @Jaakko ,

    Glad you worked it out, and yep, that all looks good.

    Cheers,

    Colin

This discussion has been closed.