On Thu, Sep 29, 2011 at 6:23 PM, galgal <[email protected]> wrote:
> How can I make that cookie without using csrf tag?
right there in the code sample you quoted:
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
where getCookie() is defined as:
function getCookie(name) { var cookieValue = null;
if (document.cookie && document.cookie != '') { var cookies
= document.cookie.split(';'); for (var i = 0; i <
cookies.length; i++) { var cookie =
jQuery.trim(cookies[i]); // Does this cookie string
begin with the name we want? if (cookie.substring(0,
name.length + 1) == (name + '=')) { cookieValue =
decodeURIComponent(cookie.substring(name.length + 1));
break; } } } return
cookieValue; }
--
Javier
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.