ajax:callback function not called for every readystatechange of the first request but called properly for subsequent requests.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   hemanth_kumar
Posted On:   Saturday, February 18, 2006 02:23 AM

Hi I am working with an ajax program. In that i have defined a callback funtion but that function is not being called for every readystatechange of the request object for the first request . but it is working fine from the second request. function find(start,number){ var nameField=document.getElementById("text1").value; var starting=start; var total=number; if(form1.criteria[0].checked) { http.open("GET", url + escape(nameField)+"&param2="+escape("exact")+"&param4="+escape(starting)+"&param5="+escape(number)); } else if(form1.criteria[2].checked) { http.open("GET", url    More>>

Hi
I am working with an ajax program.
In that i have defined a callback funtion
but that function is not being called for every readystatechange of the request object for the first request .
but it is working fine from the second request.

			
function find(start,number){
var nameField=document.getElementById("text1").value;
var starting=start;
var total=number;
if(form1.criteria[0].checked) {
http.open("GET", url + escape(nameField)+"&param2="+escape("exact")+"&param4="+escape(starting)+"&param5="+escape(number));
}
else if(form1.criteria[2].checked) {
http.open("GET", url + escape(nameField)+"&param2="+escape("prefix")+"&param4="+escape(starting)+"&param5="+escape(number));
}
http.onreadystatechange = callback2;
http.send(null);
}

function callback2(){
if (http.readyState == 4) {//request state
if(http.status==200){
var message=http.responseXML;
alert(http.responseText);
Parse2(message);
}else{
alert("response is not completed");
}
}else{
alert("request state is :-"+http.readyState);
}
}
   <<Less
About | Sitemap | Contact