Jump to content

Connect AJAX to php function


UrbanDweller

Recommended Posts

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");
}

Link to comment
https://forums.phpfreaks.com/topic/260373-connect-ajax-to-php-function/
Share on other sites

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){

 

});

 

?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.