Friday, May 17, 2013

Re: ajax get json not receive data from django

Its better to use json instead of simplejosn : json.dumps() also csrf shouldn't be your case else you would've get an 405 error. 200 requests are fine, what does firebug says about the request? normally there would be a tab called json where you could see the values that got through the request.
Also parseJSON makes no sense since you've already got json. try something like alert(data.key1) or alert(data);

Am Donnerstag, 16. Mai 2013 17:26:44 UTC+2 schrieb Alex Chiaranda:
aren't you missing the csrf_token ?

https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax

On Thursday, May 16, 2013 8:53:36 AM UTC-3, Hai Nguyen wrote:
Thanks you for your answer.
I'm trying to change  mimetype="application/json; charset=utf-8" but could not resolve problem

On Thursday, May 16, 2013 3:02:52 PM UTC+7, Zoltán Bege wrote:
I mean HttpResponse. Sorry! :)

Hi,

You should change the mimetype on HttpResponse from mimetype="application/
javascript;charset=UTF-8" to mimetype="application/json; charset=utf-8".

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

No comments:

Post a Comment