Asynchronous POST request from a Firefox's web worker

ejfjeklikajdk

New Member
I am trying to make an asynchronous request with POST method from a web worker used in my extension. The thing is that it does not work for me.On the server side I have PHP script listening for data in $_POST variable. Although I am able to establish connection to the server, and even pass some data in URL (GET), the $_POST is always empty.Here is the latest code I'm using in the web worker:\[code\]var serviceUrl = "http://localhost/pfm/service/index.php";var invocation = new XMLHttpRequest();if(invocation){ invocation.open('POST', serviceUrl, true); invocation.setRequestHeader('X-PINGOTHER', 'pingpong'); invocation.setRequestHeader('Content-Type', 'text/plain'); invocation.onreadystatechange = function(){processResponse(invocation);}; invocation.send("action=init");}\[/code\](borrowed from MDN web site when I got an idea that the issue was the same origin policy)Prior to this I was using a rather obvious and ridiculously simple:\[code\]var serviceUrl = "http://localhost/pfm/service/index.php";var xhr = new XMLHttpRequest();xhr.open("POST", serviceUrl, true);xhr.onreadystatechange = function(){processResponse(receiptStoreRequest);};xhr.send("action=init");\[/code\]In this case the request also passed, but the $_POST was still empty.Is it possible that POST-requests are not allowed on web workers?Right now everything is being tested on localhost.
 
Back
Top