I have an AJAX call (code below) that should be setting the Accept header to be sent in the server request. However, it is not doing that at all (in fact, there is no Accept header sent). This seems to have been working okay with any AJAX call other than the first from my website, for no obvious reason, although now I can't get past the first so I'm not sure if that was due to something unrelated or not.
- $.ajaxSetup({cache:false});
- $.ajax({url:mhrxDeployDir + "loggedIn.jsp",
- dataType:"json",
- accepts:"application/json",
- type:"GET",
- success:function(data) {
- // etc code
What I'm trying to do here is request a JSP page that will respond with some JSON. There is a filter in the middle that determines if I'm making AJAX calls or non-AJAX calls, and handles the security differently depending on which it is. However, the above is not setting "application/json" in the Accept header.
I did find another thread about headers not being sent in a CORS request (which this counts as), however that seemed to be an issue with custom headers, and Accept is a normal one (thread here:
https://forum.jquery.com/topic/ajax-not-setting-options-correctly-1-7-1).As it is, I'll likely have to add a data setting to every AJAX request to specify that it is AJAX, but that's a bit of a pain. Any thoughts?