You can return a flag that tells you if you have errors or not, and depending on this flag, a different data set. If this is an error, return something like:
{success: false, errors: ['Name invalid','email invalid']}
And if this is correct:
{success: true, Name:'new name',email: 'new email'}
and your script
.... $.ajax({ type: "POST", url: action, dataType: "html", data: serializedForm, success: function (result) { if(!result.success) {
To show errors, you can have a div in modal popUp, and then for each element in result.errors, add a div inside the error div.
If success is correct, find the item you clicked and update it with the date in your result.
Let me know if you do not know how to do this.
source share