tags:

views:

554

answers:

2

Hi friends,

I need some ajax code to do some functions with drop down.

I have three table of values one for country, then state and city.

And i have three dropdown to show these values

first it should show

select country

select state

select city

in that drop downs(slect) respectively.

when i select united states from the first dropdown

in the second drop down it must show the states of the united states.

and again when i select a state from the state dropdown

it must show the cities of that state in the third dropdown(city)

I want to do this with ajax.

can any one have a code to do this.

please help me.

Thanks

A: 

Can be done in so many ways...

  1. Add an change event on the first dropdown menu;

Then, how do you plan to retrieve the states for related to the first menu, and the cityes related to the second one?

Are they in a database? Or in a js array (json?)?

If they are in the database, go with ajax requests.. else, use the array.

There are so many plugins and howto's for this tread, google a bit

edit: who did remove the plz-send-me-teh-code tag?!

DaNieL
+1  A: 
create 3 tables in db

country table
==============
countryId || countryName

stateTable
=============
stateId || stateName || countryName

city table
=============
cityId || cityName || stateId

==============
now create 3 webservices
which sends data in json format

==============
now on html page
create three select box and bind onchange event on each select box (except for city select), that event will send countryId for getStates Webservcie and stateId for getCities webservice. and bind received json states in state select box and cities in city select box
Praveen Prasad
hey this i know, but i dont know the ajax function methods for this
tibin mathew
do some googling for xmlhttprequest
Praveen Prasad