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

how can I use readyonstatechange function to return data

I want to use javascript request xmlhttp to trigger java action so I used the following function as function call and return data, but can't return response cause I write return statement in other inner function like that. function…
0
votes
1 answer

VB6: get onreadystate value from browser control

I'm trying to get the onreadystate value from the browser control do detect when the page has finished loading. Unfortunately, the event's .returnValue gets returned empty. Here's my code: Dim WithEvents m_doc As HTMLDocument Private Sub…
Fuxi
  • 7,611
  • 25
  • 93
  • 139
0
votes
1 answer

javascript SOAP xmlhttprequest issue mobile

All right, so previously I asked... SOAP Prototype AJAX SOAPAction Header Question (can't hyperlink it unfortunately, not enough rep for "2" links... see below) Which never worked out. I think it has something to do with Prototype, it will return a…
0
votes
0 answers

javascript xmlhttp response works is odd

onreadystatechange() gets called 3 times. the second time 'results-div'.innerhtml is set to 'empty' and then erased on the last call to the function. also, does jquery handle ajax browser compatibility? function loaddata(){ var res = new…
nf071590
  • 1,170
  • 1
  • 13
  • 17
0
votes
3 answers

Javascript / Ajax (no jquery!) onreadystatechange stays 1

I'm writing a simple ajax function: 1 function setXMLHttpRequest() { 2 var xhr = null; 3 if (window.XMLHttpRequest) { 4 xhr = new XMLHttpRequest(); 5 } 6 else if (window.ActiveXObject) { 7 xhr = new…
sowdust
  • 87
  • 1
  • 9
0
votes
3 answers

loop doesn't work inside `onreadystatechange`

here is my code: xmlhttp.onreadystatechange = function () { if (this.readyState == 4) if( this.status == 200) { response = xmlhttp.responseXML; var channel =…
0
votes
2 answers

Proper use of onreadystatechange when attempting to write rather than retrieve

How should I use the "onreadystatechange" in an Ajax call when I'm using Ajax to write data in the database rather than retrieve data? When I retrieve data, onreadystatechange triggers a function that uses the data in some way. What kind of…
JDelage
  • 13,036
  • 23
  • 78
  • 112
0
votes
3 answers

onreadystatechange results in php code executing twice

In my onreadystatechange inline function in my Ajax code, I call window.location and pass a GET parameter to the new web page. For some reason the php code on that new page executes twice in quick succession. I don't think that is correct…
CFHcoder
  • 429
  • 2
  • 8
  • 25
0
votes
0 answers

Is there any reason why onreadystatechange wont do anything for css header link in safari?

I made a bookmarklet that loads several header. some JS some css. after i create the header element i do a onreadystatechange to check when the included header was loaded. However for some reason this check doesnt work for safari for the css…
Neta Meta
  • 4,001
  • 9
  • 42
  • 67
0
votes
1 answer

Calling xmlhttp.onreadystatechange=function() via PHP

So, here is the issue: I am trying to handle some edits within a PHP file that is being passed an ID field. The PHP file is successfully building the HTML page and displaying it, but portions of the embedded javascript call are not working. If I…
RonTron
  • 50
  • 5
0
votes
2 answers

My onReadyStateChange is never called,why?

my code is simple. function useXMLHttpRequest() { var xmlhttp = new XMLHttpRequest(); xmlhttp.open("POST", "test.ashx", false); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); xmlhttp.onReadyStateChange =…
roast_soul
  • 3,554
  • 7
  • 36
  • 73
0
votes
3 answers

POST'ing with AJAX in JavaScript, onreadystatechange needed?

When coding some JavaScript to send a POST (instead of a GET) back to the webserver, I wondered whether you need to define the XMLHttp.onreadystatechange? My code so far looks like this: XMLHttp.onreadystatechange =…
Quester
  • 81
  • 7
0
votes
1 answer

Javascript read text file issue

I have a text file ("sample.txt") residing on a server, the content of which changes at random intervals (anything from 250 ms to 10 seconds). The script below reads this text file every half a second and displays the text in the div element "cont"…
0
votes
1 answer

Onreadystatechange not not working after header redirection in Chrome

I have made a userscript for a forum that resizes images. It works great, except for after posting or editing where it redirects, where onreadystatechange does not fire in Google Chrome. When viewing a thread, EG…
scandinavian_
  • 2,496
  • 1
  • 17
  • 19
-1
votes
1 answer

Document.readystate is lying about Google Maps canvas images being loaded

I am printing a page containing google maps API v3 map from within an iframe. I implemented the following code to make sure the page has loaded fully before printing the iframe. /** * Auto print the page once the full document has finished…
TetraDev
  • 16,074
  • 6
  • 60
  • 61