aspose file tools*
The moose likes XML and Related Technologies and the fly likes ajax:Callback function not being called for every readystate change for first request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply locked New topic
Author

ajax:Callback function not being called for every readystate change for first request

K Hemanth
Greenhorn

Joined: Feb 18, 2006
Posts: 4
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)+"�m2="+escape("exact")+"�m4="+escape(starting)+"�m5="+escape(number));
}
else if(form1.criteria[2].checked) {
http.open("GET", url + escape(nameField)+"�m2="+escape("prefix")+"�m4="+escape(starting)+"�m5="+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);
}
}
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Please do not cross-post the same question to several forums!


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ajax:Callback function not being called for every readystate change for first request