stockton Posted April 4, 2007 Share Posted April 4, 2007 I am not sure that I understand the relationship between Ajax and a php script it calls. Basically what I am trying to understand is how do I return an error message from my PHP script to the Ajax/Javascript that called that PHP and how do I exit that PHP script at the point where the error occurred. Is it as simple as :- echo $Message; exit: Link to comment https://forums.phpfreaks.com/topic/45565-returning-error-messages-from-php-via-ajax/ Share on other sites More sharing options...
mainewoods Posted April 5, 2007 Share Posted April 5, 2007 echo $Message; exit: it is that simple! You might want to prefix it with some code so that when it is recieved by ajax it can tell it is an error: echo '**ERROR**' . $Message; exit: when ajax recieves its response, it will test the first characters of the response for '**ERROR**' Link to comment https://forums.phpfreaks.com/topic/45565-returning-error-messages-from-php-via-ajax/#findComment-221777 Share on other sites More sharing options...
stockton Posted April 5, 2007 Author Share Posted April 5, 2007 Thank you Link to comment https://forums.phpfreaks.com/topic/45565-returning-error-messages-from-php-via-ajax/#findComment-221869 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.