i'm new to ajax.. i did a small example using it successfully.. but the problem i'm facing is, how to display the data in a combo box.. if i know the no.of values that is coming from db i can do it, however i don know the no.of records in db..
to be more simple, if i select a country, corr.states of that country should come..
below is the code i used to dispaly if i kno the no.of records in the db
Expand|Select|Wrap|Line Numbers
- function ajaxFunction()
- {
- var xmlHttp;
- try
- { // Firefox, Opera 8.0+, Safari
- xmlHttp=new XMLHttpRequest();
- }
- catch (e)
- { // Internet Explorer
- try
- {
- xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch (e)
- {
- try
- {
- xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch (e)
- {
- alert("Your browser does not support AJAX!");
- return false;
- }
- }
- }
- xmlHttp.onreadystatechange=function()
- {
- if(xmlHttp.readyState==4)
- {
- var array;
- array=xmlHttp.responseText.split("|")
- document.form2.contact.value=array[0];
- document.form2.address.value=array[1];
- document.form2.city.value=array[2];
- document.form2.country.value=array[3];
- }
- }
- var user= document.form2.user.value
- var url = "aswajax?user=" + user;
- xmlHttp.open("GET",url,true);
- xmlHttp.send(); }
any help..
thanks in advance..
regards,
aswathn.s
(knowledge is power