ajax call says: "NetworkError: 500 INTERNAL SERVER ERROR - http://127.0.0.1:8000/ajax/"

4,085 views
Skip to first unread message

doniyor

unread,
May 5, 2012, 3:45:48 AM5/5/12
to django...@googlegroups.com
hi there, 
i have a small problem. i googled a lot, but couldnot find anything which helps me. 

i have $.ajax call and before that i have included the js file where i have that csrf-protection code from djangodocs. 

here is my ajax call: http://dpaste.com/hold/743156/

but once i click on the event, i get this error: "NetworkError: 500 INTERNAL SERVER ERROR - http://127.0.0.1:8000/ajax/". 
my urls.py has: url(r'^ajax/', 'home.views.ajax'),

and my ajax function is simply: 

def ajax(request):
    print 'test'

i dont have any clues why this is happening. can someone please help me? 

many many thanks 


 

Alexandr Aibulatov

unread,
May 5, 2012, 3:50:37 AM5/5/12
to django...@googlegroups.com
Your view should return an HttpResponse Object. Your view prints
'test' and returns NoneType Object.
Yours view should be like this:

from django.http import HttpResponse

def ajax(request):
return HttpResponse('test', mimetype="text/plain")

2012/5/5 doniyor <doniy...@googlemail.com>:
> --
> 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/-/1Y1E6RZOc7wJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

doniyor

unread,
May 5, 2012, 3:53:42 AM5/5/12
to django...@googlegroups.com
great, thanks man. i didnot see it. 


Reply all
Reply to author
Forward
0 new messages