hi dere,
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
[CODE=javascript]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.XMLHT TP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onready statechange=fun ction()
{
if(xmlHttp.read yState==4)
{
var array;
array=xmlHttp.r esponseText.spl it("|")
document.form2. contact.value=a rray[0];
document.form2. address.value=a rray[1];
document.form2. city.value=arra y[2];
document.form2. country.value=a rray[3];
}
}
var user= document.form2. user.value
var url = "aswajax?us er=" + user;
xmlHttp.open("G ET",url,true) ;
xmlHttp.send(); }[/CODE]
any help..
thanks in advance..
regards,
aswathn.s
(knowledge is power
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
[CODE=javascript]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.XMLHT TP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onready statechange=fun ction()
{
if(xmlHttp.read yState==4)
{
var array;
array=xmlHttp.r esponseText.spl it("|")
document.form2. contact.value=a rray[0];
document.form2. address.value=a rray[1];
document.form2. city.value=arra y[2];
document.form2. country.value=a rray[3];
}
}
var user= document.form2. user.value
var url = "aswajax?us er=" + user;
xmlHttp.open("G ET",url,true) ;
xmlHttp.send(); }[/CODE]
any help..
thanks in advance..
regards,
aswathn.s
(knowledge is power
Comment