Jump to content

Dynamic Drop Down, I'am a complete Ajax newbie, need help urgently please


Recommended Posts

Hi all,

I'm busy with a website for a South African tourism company,

they want the bookings system to be very user-friendly,

so I made a few dropdowns in PHP, but now comes the hard

part for me, I have to create a onchange event and use Ajax

to send the server request and database query, and retrieve

the content and then use it in the next drop down...  :wtf:

 

So basically it's a country dropdown, and after that follows the

province/state dropdown and it's content should be relative to that

of the country, and then again for the towns... There isn't any code

that I think will be of use, only PHP echoes for a HTML form

and select boxes, if you need anything else I'll be happy

to post it..

 

Can you also please explain the Ajax I need in this situation, because

I really want to know how Ajax works for any future projects

requiring it  :shrug:

 

Thanks, I really appreciate it!

Chaos...

Thanks for the reply, yes I also looked at Ajax in books like Head First Javascript and Javascript Bible, but most of them only return xml documents. I think what I need to do is make the first dropdown available, and when someone chooses an option I somehow have to use Ajax to add something like country=southafrica to the url, is that possible? Also, can I use Ajax to add the second and third dropdowns only when the previous dropdown changes? Thanks! Chaos

Hi, thanks, I went through that tutorials after you sent your message, but now I just want to know if this will be possible: the php script already echoes the select element and query the database, but what I need to know is how do I send the variables using ajax to that php page and can I return the entire select with it's values and insert it into the page using Ajax? Thanks!

Are you using any JS library like jQuery or YUI? If you don't I would highly recommend it especially jQuery, it has tons of plugins it's quite possible they have a plugin that does just that for you where you would pass the three id's (of your select) in sequence.

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.