I use NanoHTTPD as web server in my Android APP, I submit some date using the function SubmitCheckedItemsForm()
in client.
In web server client, I can receive "POST" method information when I lanuch the code in both FireFox and Chrome, but I receive "GET" method information when I lanuch the code in IE 11.0? Why?
Server Code
@Override
public Response serve(IHTTPSession session) {
String uri = session.getUri();
Method method = session.getMethod();
Utility.LogError("Method: "+method);
}
HTML
<form action="" method='post' enctype='multipart/form-data' id="FormForAction">
</form>
JS
function SubmitCheckedItemsForm(action) {
var mytemp = GetArrayOfCheckedItems();
var formID = "#FormForAction";
$(formID).unbind("submit");
alert(mytemp);
$(formID).submit(function (eventObj) {
$(formID).empty();
$('<input />').attr('type', 'hidden')
.attr('name', action)
.attr('value', JSON.stringify(mytemp))
.appendTo(formID);
});
$(".FilenameCheckboxForSelect").prop("checked", false);
$(formID).submit();
}
Modified JS
function SubmitCheckedItemsForm(action) {
var mytemp = GetArrayOfCheckedItems();
var formID = "#FormForAction";
$(formID).unbind("submit");
alert(mytemp);
$(formID).submit(function (eventObj) {
$(formID).empty();
$('<input />').attr('type', 'hidden')
.attr('name', action)
.attr('value', JSON.stringify(mytemp))
.appendTo(formID);
$('<div>Body</div>').appendTo(formID);
});
$(".FilenameCheckboxForSelect").prop("checked", false);
$(formID).submit();
}
Finally I found out this. That when you use the browser to send an HTTP POST request in Internet Explorer 11. When a HTTP POST request is sent without a message body, the GET method is used instead. This is a browser issue. You can check it on the Microsoft support page also. Here: issue with Form method attribute