UrbanDweller Posted April 5, 2012 Share Posted April 5, 2012 Hey, I have never touched AJAX due to never needing it until now. I have looked up some tutorial but dont understand how they link to what you need done. What I am wanting to do is send the select option value to a php function that then searches the table for the required output then it in another select tag depending on what option is chosen. I basicly need help defining the need ajax syntax to do such a process? by the way does php create the select tags or javascript? <select id="elem1"> <option value="101">category one</option> <option value="102">category two</option> <option value="103">category three</option> </select> <?php function getChild(){ $parent_id = $_GET['elem1]; $result = dbQuery("SELECT cat_id, cat_name FROM catagory_tbl WHERE parent_id=$cat_id"); } Quote Link to comment https://forums.phpfreaks.com/topic/260373-connect-ajax-to-php-function/ Share on other sites More sharing options...
trq Posted April 5, 2012 Share Posted April 5, 2012 This previous reply might help you. http://www.phpfreaks.com/forums/index.php?topic=356177.msg1685225#msg1685225 Quote Link to comment https://forums.phpfreaks.com/topic/260373-connect-ajax-to-php-function/#findComment-1334532 Share on other sites More sharing options...
UrbanDweller Posted April 5, 2012 Author Share Posted April 5, 2012 Sorry but i dont understand how exactly how jquery ajax call is able to retreive the variable created in the php function that was called At the moment all im trying is to return a php string to jquery to use all i can imagine is success: function(phpVar){ }); ? Quote Link to comment https://forums.phpfreaks.com/topic/260373-connect-ajax-to-php-function/#findComment-1334633 Share on other sites More sharing options...
UrbanDweller Posted April 8, 2012 Author Share Posted April 8, 2012 Figured it out in the end was trying something a bit different to that guy but cheers. Quote Link to comment https://forums.phpfreaks.com/topic/260373-connect-ajax-to-php-function/#findComment-1335287 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.