Jump to content

Ajax noob...


ChaosKnight

Recommended Posts

Hi, I'm an Ajax noob and I don't know how it works yet,

in the webpage that I'm busy with there are 4

select dropdowns, the first is for countries, second for

provinces, third for towns and the last is for the hotels

that match all previous criteria...

 

The province should only display if the country global var

is 'southafrica', and the dropdowns should auto-generate

relative content from the database, I tried jQuery solutions

but none that I found does this very specific task, the

database will soon have thousands of entries so it should

be as dynamic as possible

 

Please help

 

I tried this function but it did absolutely nothing:

function getProvince(country)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="getprovince.php";
url=url+"?country="+country;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

 

And this was how I called it:

<select id='countrySelect' name='country' onchange='getProvince(this.value);'>

 

Can you please also guide me in the right direction

for all the other select dropdowns?

 

Thanks a lot!

Link to comment
Share on other sites

Hi ,

 

You are missing some minor but important things .

 

I can say here but i recommend you to find the ajax code on http://www.w3schools.com/ajax/default.asp or related tutorial.

 

They will teach you from base.

So you get clear idea on how to use ajax ?

 

Its not hard but tricky.

 

Try out your self if dont get ready to help :)

 

 

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.