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? Quote Link to comment 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(); ?> Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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.