Re: django-ajax giving 403

2012-10-30 Thread Nicolas Emiliani
On Tue, Oct 30, 2012 at 1:03 PM, Chris Pagnutti wrote:

> Hi.  I'm trying to make some AJAX calls using django-ajax
> https://github.com/joestump/django-ajax
>
> But when I make the call, Chrome's console gives POST
> http://127.0.0.1:8000/ajax/my_app/my_ajax_view.json403
>  (FORBIDDEN)
> If I visit the url directly in my browser, I get {"data":{"message":"Invalid
> HTTP method used.","code":400},"success":false}
>
> Reading the docs, it seems likely that the problem may be with related to
> not explicitly passing the csrf token in my jquery .ajax() call. But the
> django-ajax docs/instructions don't mention anything about this, and I
> kinda figured the whole point of django-ajax is to simplify these matters.
>
> Anyone use django-ajax that can help? What do most django developers use
> for ajax? I've checked out Dajax, but I find it a bit much, yet I'm willing
> to give it, or some other package another try.
>

I used dajaxice  successfully (it is fearly simple) in a project that
updates a google map with markers every time you move the map. It worked
just fine. As Tom said my views also returned JSON. Regarding de CSRF token
you only need to include the CSRF tag at the view tamplate and that's
mainly it.

Check this example out :

http://www.dajaxproject.com/dajaxice/



> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/eTD4Xw3RQxUJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-ajax giving 403

2012-10-30 Thread Tom Evans
On Tue, Oct 30, 2012 at 4:03 PM, Chris Pagnutti
 wrote:
> Hi.  I'm trying to make some AJAX calls using django-ajax
> https://github.com/joestump/django-ajax
>
> But when I make the call, Chrome's console gives POST
> http://127.0.0.1:8000/ajax/my_app/my_ajax_view.json 403 (FORBIDDEN)
> If I visit the url directly in my browser, I get {"data":{"message":"Invalid
> HTTP method used.","code":400},"success":false}
>
> Reading the docs, it seems likely that the problem may be with related to
> not explicitly passing the csrf token in my jquery .ajax() call. But the
> django-ajax docs/instructions don't mention anything about this, and I kinda
> figured the whole point of django-ajax is to simplify these matters.
>
> Anyone use django-ajax that can help? What do most django developers use for
> ajax? I've checked out Dajax, but I find it a bit much, yet I'm willing to
> give it, or some other package another try.
>

Mostly I write views that return JSON, and then call them from
javascript, usually using jQuery. That's enough automation for me.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-ajax giving 403

2012-10-30 Thread Chris Pagnutti
Hi.  I'm trying to make some AJAX calls using django-ajax 
https://github.com/joestump/django-ajax

But when I make the call, Chrome's console gives POST 
http://127.0.0.1:8000/ajax/my_app/my_ajax_view.json403
 (FORBIDDEN)
If I visit the url directly in my browser, I get {"data":{"message":"Invalid 
HTTP method used.","code":400},"success":false}

Reading the docs, it seems likely that the problem may be with related to 
not explicitly passing the csrf token in my jquery .ajax() call. But the 
django-ajax docs/instructions don't mention anything about this, and I 
kinda figured the whole point of django-ajax is to simplify these matters.

Anyone use django-ajax that can help? What do most django developers use 
for ajax? I've checked out Dajax, but I find it a bit much, yet I'm willing 
to give it, or some other package another try.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/eTD4Xw3RQxUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.