Closed Bug 337810 Opened 19 years ago Closed 19 years ago

XMLHttpRequest's synchronous mode not working

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 313646

People

(Reporter: dan.rades, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 If you have an XMLHttpRequest object, and you want to recive data synchronous it will not work. Example: var aVar = 'some text'; request = new XMLHttpRequest; request.open('GET', 'http://localhost/someurl.js', false); request.onreadystatechange = function() { if (request.readyState == 4) { aVar = request.responseText; return; } request.send(null); alert(aVar);//it will alert 'some text' instead of the value of request.responseText I've tested with IE5.5/6 Opera 8.54 and works fine with them; Reproducible: Always
Attached file testcase (deleted) —
testcase loading "/" in the request
*** This bug has been marked as a duplicate of 313646 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
confirm on FF 3.0.1 <script> r=new XMLHttpRequest() r.onreadystatechange=function(){if(r.readyState==4)alert(r.responseText)} r.open('GET','1.txt',false) r.send(null) </script>
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: