Prevent Cookies From Being Sent on AJAX Request

Posted by user340571 on Stack Overflow See other posts from Stack Overflow or by user340571
Published on 2010-05-13T18:13:20Z Indexed on 2010/05/13 18:24 UTC
Read the original article Hit count: 165

Filed under:

Hello everyone,

I have a web service that I invoke from script but that does not need any information stored in cookies. Anytime I make a request to the service, the cookie is sent along with it. I understand that by default cookies are sent with HTTP request, but is there any way at all to overwrite that behavior and not send the cookie?

In a nutshell, I am issuing my request like this:

$.ajax({ type: "POST", cache: false, url: url, data: data, contentType: "application/json; charset=utf-8", dataType: "json", success: function(response) { successFunc(response); }, error: function(xhr) { errorFunc(xhr); } });

© Stack Overflow or respective owner

Related posts about jquery-ajax