Questions tagged [onreadystatechange]

An XMLHttpRequest event handler. Called whenever the readyState attribute changes.

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/onreadystatechange

106 questions
2
votes
3 answers

Need Help Understanding Ajax Function

So I just finished writing my first Ajax function. I did it all from a google tutorial and w3schools and it's finally working. The only problem is I don't fully understand the logic of what is happening and am looking for an explanation! Here is my…
gmustudent
  • 2,229
  • 6
  • 31
  • 43
2
votes
3 answers

Stop page refresh

I'm writing a small piece of code which takes input from a user via html form to then retrieve information (in xml) from a server (which is running locally) using XMLHttpRequest, once I get the information I output it into a list using the method…
haakym
  • 12,050
  • 12
  • 70
  • 98
1
vote
1 answer

Javascript Ajax save result of onreadystatechange in global variable

I'm trying to write a script to retrieve a WOEID and interface with the Yahoo Weather API. I'm constructing a URL based on latitude and longitude values from stuff in a database I'm using, and can do this perfectly fine. However, when it comes to…
Jagot
  • 13
  • 1
  • 3
1
vote
0 answers

server crashes when i use onreadystatechange

I am trying to create a chat for my website. To load the new data, i run a function every 1.5''. If i use asynchronous mode, my website is fast, my server does not crash, but browser freezes until the response. When i use synchronous mode, my server…
1
vote
1 answer

callback from flashembed of jquery Tools

jQuery Tools includes a flashembed API which accepts many parameters. Is there one which accepts callback function and fires after the success state of the flash player load event?…
Umesh Patil
  • 10,475
  • 16
  • 52
  • 80
1
vote
0 answers

XMLHTTPRequest dealing with event

I am performing an Ajax (JQuery) request on a php script which iterates. At each iteration I do an "echo" of the value of the loop counter, encoded in JSon. The goal is to manage the display of a progress bar. By doing this I hoped to intercept and…
AC24
  • 53
  • 4
1
vote
1 answer

AJAX Results in Div Dissapearing

Using AJAX to call a CGI script which opens a file and prints it out in a DIV. This works fine on a test page I have but for some reason in another page it will print the contents into the DIV and then will clear out the DIV. Using alert() I can…
user770395
  • 33
  • 6
1
vote
2 answers

Can I use jQuery prefilters to detect onreadystatechange events where readyState==3?

I'm trying to implement the XHR streaming Comet technique in jQuery, but am having some trouble detecting the onreadystatechange event. I'm using Firefox 4.0.1. I'm using prefilters (available since jQuery 1.5) to modify the native XHR object,…
jqp
  • 657
  • 1
  • 8
  • 18
1
vote
0 answers

Add a "Loading..." message while the Google Custom Search bar is still not visible, then remove the message when it is already visible

I am using a Google Custom Search bar and it takes several seconds for the search bar to display on the page. Because of this, I want to add a "Loading.." message while the search bar is still not displayed, then remove the message by the time the…
JAT86
  • 997
  • 12
  • 24
1
vote
1 answer

XMLHttpRequest onreadystatechange long delay between readyState 1 and 2

My JS code is sending out requests and monitors "xhr.onreadystatechange". Sometimes it will collect the following logs, which are expected: timestamp event method readyState status 1/9/2018 9:08:43.474 xhr_readystatechange POST 1 …
yoduoy
  • 21
  • 6
1
vote
2 answers

onreadystatechange in a loop, readystate changes too late

I issue in a loop a total of eight xmlhttprequests to a Google map server and process the json objects the server returns to retrieve the zip codes. The code works fine if the xmlhttprequests are synchronous. Since I'm supposed to use asynchronous…
yky
  • 11
  • 2
1
vote
0 answers

Does onreadystatechange == complete fire after CSSOM is loaded?

The question is small and simple: Does onreadystatechange == complete fire after CSSOM is loaded? Please mention some authorotative reference in your answer so I could cross check. Thanks :-)
user31782
  • 7,087
  • 14
  • 68
  • 143
1
vote
2 answers

return value from onreadystatechange with callback

I'm trying to return a value from an onreadystatechange AJAX call... I found this page : stackoverflow link. I though I had it working but realised that it made no difference to add or remove the fn function. The following code works…
Ivan
  • 34,531
  • 8
  • 55
  • 100
1
vote
2 answers

Retrieving Value from Anonymous Function & onreadystatechange

I have a function from which I would like to return a value as a series of events whenever a button is clicked. However, I can't figure out how to retrieve the value from onreadystatechange. How can I make it so I can return…
Andy
  • 3,132
  • 4
  • 36
  • 68
1
vote
0 answers

Simple onreadystatechange not firing even though script loads

I'm probably just missing something basic about onreadystatechange. Why doesn't either console message occur here? c.js runs just fine.