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

 

});

 

?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.