I have a service which is configured to support CORS. Ususally when I do a server request, I prepare a request object through jQuery
and, adding the withCredentials
parameter set to true
, it is working fine.
But I have a jqGrid
with server pagination and I can't manage completelly the xhr
object. I've added the loadBeforeSend
event, where I've added some headers and are being sent to server properly.
And I've also seen this post (related to jQuery
ajax requests): possible answer. I've tried to add the withCredentials
property to the xhr
object by the following way:
$('#grid').jqGrid({
loadBeforeSend: function (jqXHR, settings) {
jqXHR.setRequestHeader('Accept-Language', 'en-US');
jqXHR.setRequestHeader('SiteApplication', '1');
jqXHR.withCredentials = true;
}
});
and even by this way:
$('#grid').jqGrid({
loadBeforeSend: function (jqXHR, settings) {
jqXHR.setRequestHeader('Accept-Language', 'en-US');
jqXHR.setRequestHeader('SiteApplication', '1');
jqXHR.xhrFields = {
withCredentials: true
}
}
});
Similar to the solutions explained in the post. But it didn't work.
Any idea of how send to server the cookies?