I'm struggling with a strange issue where, only on iOS Safari browsers, my XMLHttpRequest POST get the following error:
"The remote host closed the connection"
Here's the JS code that creates and sends the request:
var formData = new FormData();
formData.append('someField1', val1);
formData.append('someField2', val2);
var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == 4 && request.status == 200) {
callback(request.responseText);
}
}
request.open('POST', url);
request.send(formData);
and here's the server side code that attempts to read the form data, but all values for some reason are null - again - only on iOS Safari browsers.
string var1 = Request.Form["someField1"];
string var2 = Request.Form["someField2"];
I think it might have something to do with this posted bug, but I can't seem to fix the issue since I don't know which values to send in the header, spcifically how to add the Content-Type to the request's header and with which value.