Hi,
I'm using the following code to request data from an ASP.net MVC application. I'm also using TcpTrace so that I can see the request/response.
if (isInteger($('#txtDay').val()) && isInteger($('#txtMonth').val()) && isInteger($('#txtYear').val())) {
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: strApi + 'wip/job/getsummary/' + $('#txtYear').val() + '/' + $('#txtMonth').val() + '/' + $('#txtDay').val(),
data: '{}',
dataType: 'json',
cache: false,
beforeSend: function(XMLHttpRequest) { ShowLoading(); },
success: function(data, textStatus) {
ShowJobSummaryList(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
HideLoading();
ShowStatus('unable to retrieve job summary list');
alert(XMLHttpRequest.statusText);
alert(textStatus);
},
complete: function(XMLHttpRequest, textStatus) {
HideLoading();
}
});
}
Using IE everything works fine - the content type is correctly set to application/json. However under Firefox 3.5.5, the content type is missing:
OPTIONS /api/wip/job/getsummary/2009/11/25 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Origin: http://localhost
Access-Control-Request-Method: POST
Access-Control-Request-Headers: x-requested-with
This causes the ASP.net MVC to return XML. Can anyone explain why Firefox does not send the content type?