Catch the result of form.send() to display the message on the client side

Hi

When I use the xxxxxx method to send data to the server, I don’t know how to get the client side success or failure message back to display to the user.

Can someone help me.

Form.send() method returns Promise object, that you can use for handling servers’s response. For example, in case of success server returns such json:
{"status":"ok", "message":"Everything fine"}
and in case of failure server returns json:
{"status":"er", "message":"Something went wrong"}

You can use this code:

form.send('form_processing.php').then(function(r) {
        r = JSON.parse(r);
        if(r.status=='er') dhx.alert({text: r.message, buttonsAlignment:'right'});
        else {
            // do something ....
            dhx.alert({text: r.message, buttonsAlignment:'right'});
        }
    });

Thank you verry much proldapru,
I try, and get back.