In my application I have a dataTable to display record from db, I am trying to edit record using x-editable and its working fine. But the problem is I want to display an error message if submitted data not updated successfully into the db.
I tried 'success:' but it triggered after submit the form whatever the data reach the db or not, but i want to trigger the success if controller return true.
Thanks
if you are processing the editable submission using ajax you need to set:
echo 1; //if model returns true
and
echo 0; //if model returns false
in the controller.
Then in the ajax reponse you need to check in the script:
(Consider the response variable is response)
if(response==1)
{
alert('Update Success.');
}
else
{
alert('Update Failure !')
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With