0

Possible Duplicate:
Jquery validation - checking email and username availability from server-side Django

I want to remote check the username and email availability with Jquery validation plugin. But I'm getting 403 Forbidden - CSRF verification failed. I don't know where to use Django csrf template tag for the Jquery Post Request.

views.py:

def email_check(request):
    response_str="false"
    if request.is_ajax():
        e = request.POST.get("email_address")
        try:
            obj = User.objects.get(email=e)
        except DoesNotExist:
            response_str="true"
    return HttpResponse(response_str)

urls.py:

url(r'^signup/email/check/$', 'registration.views.email_check')

signup.html: https://gist.github.com/2253002

Could anyone help me?

Thanks!

Community
  • 1
  • 1
rnk
  • 2,174
  • 4
  • 35
  • 57

0 Answers0