I’m using a jquery to make an $.ajax request. It works fine in chrome/firefox and other browsers as far as I know however in IE it works first time then when a second request is made in IE the ajax fails with a 406 non acceptable error.
I’ve tried setting different accept headers with no luck. Any ideas?
$.ajax({
type: Request.method,
url: Request.request_url,
cache: false,
data: Request.getVarsString(),
dataType: "text",
beforeSend: function(req){
req.setRequestHeader("Accept", "text/html,application/xhtml+xml/application/xml;q=0.9,*/*;q=0.8");
req.setRequestHeader("Accept-Language", "en-gb,en;q=0.5");
req.setRequestHeader("Accept-Encoding", "gzip, deflate");
Request.loadBeforeSend(id);
},
success: function(replyData){
Request.requestComplete(id, replyData);
},
error: function(jqXHR, textStatus){
alert(textStatus+" "+jqXHR.status);
//Request.requestComplete(id, replyData);
}
});
Im using a get method.
Request is a static class with some methods and variables that i use to make an Ajax request
I’m not totally sure why IE was doing it but I have a hashed URL. At the time it was displaying a hash of “#!/querystring” but when I changed it to “#!querystring” it worked fine.
I’d be interesting in knowing if anyone knows why IE doesn’t like the first example.