Re: CSRF in javascript

2013-07-21 Thread Karl Arunachal
Ok! I will check. Thank you! On Sun, Jul 21, 2013 at 4:27 AM, Fred Stluka wrote: > Karl, > > You are calling render_to_response() wrong. See the docs at: > > https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response > > Instead of: > > > variables = Reque

Re: CSRF in javascript

2013-07-20 Thread Fred Stluka
Karl, You are calling render_to_response() wrong. See the docs at: https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response Instead of: variables = RequestContext(request, { 'bookmarks':[bookmark], 'show_edit'

Re: CSRF in javascript

2013-07-20 Thread Karl Arunachal
I am sorry, i am really new to this things. Could you please point me out as to where I should add it. *js file: *function bookmark_edit() { var item = $(this).parent(); var url = item.find(".title").attr("href"); item.load("/save/?ajax&url=" + escape(url), null, function () {

Re: CSRF in javascript

2013-07-20 Thread Fred Stluka
Karl, Since you already have a form, and are already submitting it as an Ajax request via JavaScript, the easiest way is to just put the {% csrf_token %} in the Django template for the page. We do that for our Ajax forms. If you are not using a Django template to generate the form, there are lot

CSRF in javascript

2013-07-20 Thread Karl Arunachal
Hi, In my users page, i have in place editing with ajax. And when i click edit, it works fine. But when i submit the form, it don't do anything. When i checked, this is the error: CSRF verification failed. Request aborted. So, how do I place {% csrf_token %} in my javascript? Please advice. Than