Skip to content Skip to sidebar Skip to footer

XMlHttpRequest Is Not Working In Firefox Extension

The following code is working fine in Google Chrome but not in Firefox. I can't make a request and can't receive a response. I don't know what the problem is? This is my Javascrip

Solution 1:

How about if you add X-Requested-With header like this:

xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");

Also i would use xmlhttp.send(null); because some old Firefox browsers requires that null argument. And one last thing: I wouldn't call xmlhttp.open before I have first declared onreadystatechange listener.

Good luck, I hope this helps.


Solution 2:

have you tried setting the content type before calling the send?

like this

xmlhttp.setRequestHeader("Content-Type",    "application/x-www-form-urlencoded");

Post a Comment for "XMlHttpRequest Is Not Working In Firefox Extension"