An example from Microsoft does nearly exactly what you do in your code:
var oReq = new XMLHttpRequest();
oReq.open("POST", sURL, false);
oReq.setRequestHeader("Content-Type", "text/xml");
oReq.send(sRequestBody);
From here, the only possible point of failure that I can even conceive of would be a bug in supporting the specific application/x-www-form-urlencoded
value for Content-Type
, which I very seriously doubt is an extant problem.
Remember also to include a JSON library, because IE7 does not include a native JSON
object.