Synchronous ajax request in mozilla

P

Prasad

Hi all!
I am trying to access a page through Synchronous Ajax request in
mozilla firefox
I could not get the response ..
After the requset is sent , "onreadystatechange" function is not being
called .. (it does mean that State is not changing ..)

<script>
var req = new XMLHttpRequest();
req.open('GET', '_temp_delete.html', false);

req.send(null);
req.onreadystatechange = function(){
if(req.readyState==4)
{
if(req.status == 200)
alert(req.responseText);
}
};

</script>



But i can view the response in mozilla "firebug console"

What is the problem here ? Any code changes to be made ??
Please help me out ..
 
D

Dag Sunde

Prasad said:
Hi all!
I am trying to access a page through Synchronous Ajax request in
mozilla firefox
I could not get the response ..
After the requset is sent , "onreadystatechange" function is not being
called .. (it does mean that State is not changing ..)

<script>
var req = new XMLHttpRequest();
req.open('GET', '_temp_delete.html', false);

req.send(null);
req.onreadystatechange = function(){
if(req.readyState==4)
{
if(req.status == 200)
alert(req.responseText);
}
};

</script>



But i can view the response in mozilla "firebug console"

What is the problem here ? Any code changes to be made ??
Please help me out ..

As far as I know, you don't need the onreadystatechange
when you send synchronous.

req.send(null);

will block until the respons is received, and the you just go:

alert(req.responseText);
 
P

Prasad

Dag said:
As far as I know, you don't need the onreadystatechange
when you send synchronous.

req.send(null);

will block until the respons is received, and the you just go:

alert(req.responseText);

Thanx it worked out for me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,037
Messages
2,570,371
Members
47,014
Latest member
TashaMorei

Latest Threads

Top