I'm adding a custom header to the AJAX requests so the server knows which version of my wrapper app is making the request. To add the custom header I have
$.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader('X-MyCustomHeader', 'Value');
}
});
I need to change to a page on the server that takes some post data, which I do with
$.mobile.changePage("/Controller/PostAction", {
type: "post",
data: postData
});
However, I end up with a loading error and a blank screen.
Tracing the network requests sent through the app shows that the request to the server ended up as a GET
rather than a POST
Without the custom header the changePage
call works exactly as it should.
Does anyone know why adding the custom header is breaking it?