lilmer Posted August 6, 2014 Share Posted August 6, 2014 Hello I am using JSONP as dataType on my AJAX, but there's an incident that a Transaction was successfully complete but a PHP error text occured while trying pass the data. E.g. SMTP Error: Data not accepted. Unable to send Mail: SMTP Error: Data not accepted.<p>SMTP server error: Requested action aborted: This mail account has sent too many messages in a short amount of time. Please try later. </p> jQuery111001592713373247534_1407318091484({"result":11308,"err":"no"}) There was an unexpected error happen, SMTP Error. So in my javascript jquery ajax the response will go to .error(function(xhr,status,error){ console.log(xhr); }); But the thing here is that the transaction was successfully complete. So how do I tell the to the client side about the transaction process and the error happen? Quote Link to comment https://forums.phpfreaks.com/topic/290301-ajax-control-server-side-error-occure/ Share on other sites More sharing options...
gristoi Posted August 6, 2014 Share Posted August 6, 2014 you need to catch the exception in the php code, and if caught return a json object with the correct error code. the problem you have is an error shows, but the script keeps executing Quote Link to comment https://forums.phpfreaks.com/topic/290301-ajax-control-server-side-error-occure/#findComment-1486987 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.