hchsk Posted May 4, 2009 Share Posted May 4, 2009 how can ajax be used to get the return value of a php function, not the responseText? Link to comment https://forums.phpfreaks.com/topic/156782-ajaxrequestresponsereturn/ Share on other sites More sharing options...
the182guy Posted May 4, 2009 Share Posted May 4, 2009 There is no xmlHttp.responseReturn property. Use responseText. To get a value from a php function simply echo the function on the page. Then call that page with your Ajax code. <?php function something() { return 'my data'; } echo something(); ?> Link to comment https://forums.phpfreaks.com/topic/156782-ajaxrequestresponsereturn/#findComment-825626 Share on other sites More sharing options...
hchsk Posted May 4, 2009 Author Share Posted May 4, 2009 is there any way that i can pass parameters to a function through ajax? Link to comment https://forums.phpfreaks.com/topic/156782-ajaxrequestresponsereturn/#findComment-826115 Share on other sites More sharing options...
the182guy Posted May 4, 2009 Share Posted May 4, 2009 Yes, make your Ajax call to a PHP page like this one: function something($value) { //do something } something($_GET['value']); When you make your ajax call, pass the variable into the page in the querystring such as: http://www.site.com/page.php?value=182 Link to comment https://forums.phpfreaks.com/topic/156782-ajaxrequestresponsereturn/#findComment-826229 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.