Skip to content Skip to sidebar Skip to footer

Http Post In Javascript In Firefox Extension

I'm a newbie trying to do a simple HTTP post in JS within a Firefox extension.. This isn't passing through the parameters: var params = 'a=1&b=2&c=3' req.open('POST', 'http

Solution 1:

Make sure you've included the header to tell the server what type of request body you're sending it:

req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

(Assuming req is an XMLHttpRequest created earlier in the code.)

Solution 2:

Make sure you add

var req = new XMLHttpRequest(); 

Solution 3:

You don't need an extension, plain JavaScript can do this:

Asynchronous cross-domain POST request via JavaScript?

Post a Comment for "Http Post In Javascript In Firefox Extension"