Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Report post to moderator
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);
}
}
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question to several forums!
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!