Make sure you include the header to tell the server what type of request body you are sending it to:
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
(Assuming req is an XMLHttpRequest created earlier in the code.)
source share