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
18
votes
2 answers

document.readystate of "interactive" vs. ondomcontentloaded?

Could anyone tell me the difference between the "interactive" state of document.readyState and "DOMContentLoaded"? I couldn't find a lot of info on the "interactive" state and what specifically is available to be used in the page. This page says:…
Yansky
  • 4,580
  • 8
  • 29
  • 24
17
votes
2 answers

Is there a way to tell when your react app page is done loading the page / assets?

I have a script in my react app that I would like to run after the page is completely done loading. I've tried listening for the window load like this in componentDidMount / componentDidUpdate: document.onreadystatechange = function () { if…
zero_cool
  • 3,960
  • 5
  • 39
  • 54
12
votes
5 answers

browserify and document ready?

I'm struggling with using Browserify and document ready events. How do I craft a module that exports content only available after the document ready event has fired? How do I depend on such a module? My first stab was to try to set module.exports…
robrich
  • 13,017
  • 7
  • 36
  • 63
11
votes
3 answers

dynamically creating script: readyState never "complete"

I'm trying to do something AFTER a script is completely loaded. (IE8) Script I use for testing: http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js and the invalid one:…
pepsi600
  • 145
  • 1
  • 2
  • 7
9
votes
3 answers

jQuery $.ajax and readyStates

How to call the Ajax ready states on the jQuery $.ajax method?
tetris
  • 4,302
  • 6
  • 28
  • 41
6
votes
1 answer

What does ‘readystatechange’ event for ‘window’ mean?

Trying to handle window.onreadystatechange, I notice this event firing two times during page load. But I cannot figure out what exactly becomes changed after each event. If it were not for window, but for document, then there had been…
user6423602
5
votes
4 answers

in jquery how to call a function after an ajax request has been sent?

How can I call my function: myFunc1 in jquery after the browser has completely sent an ajax request? I want to run a callback function after a jquery ajax has been sent. I don't want to do this on complete or success because I don't want to wait for…
user566245
  • 4,011
  • 1
  • 30
  • 36
4
votes
1 answer

History.js onstatechange in IE7 does not work

I integrated History.js and this piece of code runs on URL change: History.Adapter.bind(window,'statechange',function(){ var State = History.getState(); alert(State.url) showPage(State.url); }); It works well in all browsers except IE7…
4
votes
1 answer

Are there useful uses of readyState different from "4" (complete) in a XHR.onreadystatechange callback?

Have you ever used an XHR object to intercept onreadystatechange with a readyState different from "4" (complete) ? I'm curious to know if you ever trigger a function with the possible different values. I cannot imagine a real use of the others…
yuri
  • 575
  • 1
  • 14
  • 33
4
votes
1 answer

XMLHttpRequest methods order is important?

This code works fine: function callFromFlex(url, method, payload) { console.log("call from Flex: " + method + " " + url + " " + payload); var xhttp = new XMLHttpRequest(); xhttp.open(method, url, true); …
4
votes
1 answer

XmlHttpRequest get callback response when request fails

I have a simple request I make to my service: var request = new XMLHttpRequest(); request.open("OPTIONS", url, true); request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); request.setRequestHeader('Accept',…
4
votes
2 answers

Check loading of Javascript properly

I have 10 js files. I am loading all the file before java class load. But I need to check that all the files are loaded properly then I call my java class. Firstly I call one js file which load my all the required js files, here I need to check the…
Kushal Jain
  • 3,029
  • 5
  • 31
  • 48
4
votes
3 answers

onreadystatechange in jQuery v1.4

The new jQuery v1.4 says this... jQuery.ajax() is now using onreadystatechange instead of a timer Ajax requests should now take fewer resources by using onreadystatechange instead of polling. I am not sure exactly what this means but on my site…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
4
votes
1 answer

Script onreadystatechange race condition in Internet Explorer for multiple jQuery versions

imagine the following setup: A page that has an old jQuery version (say 1.5.2) - that I have no control over - loads a Javascript file from my servers that also need jQuery, but a more recent version. (for example 1.8.3) Now my script tries to do…
S.B.
  • 2,920
  • 1
  • 17
  • 25
3
votes
1 answer

Clear stdout in Python after flush()

I'm trying to make my Python script stream its output to my webpage as its printed. So in my javascript I do: var xmlhttp; var newbody = ""; xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==3) { …
Jeff
  • 12,147
  • 10
  • 51
  • 87
1
2 3 4 5 6 7 8