Ask a Question
Advertise on boostr.in
difference between php echo and return in terms of a jquery ajax call using -'php,jquery,ajax,return,echo'
difference between php echo and return in terms of a jquery ajax call ¬†using -'php,jquery,ajax,return,echo'
I was having trouble getting a jQuery Ajax call's success function to work properly and it was pointed out to me that the reason was that my PHP function was using return $result when I should be using echo $result.
Changing the PHP function that the Ajax called from "return $result" to "echo $result" fixed the problem, but why? There's loads of explanations as to the difference between the two (return and echo) in terms of PHP scripts, but how do they differ when sending that value to an Ajax call?
Sep 7, 2015
to add a comment.
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please