Hi everyone,

     I have a login form for which I want the client to send AJAX POST 
request as below with error handling. In case of validation/authentication 
errors, I don't the page to be reloaded or refreshed to the url 
corresponding to POST request Handler(/users/login/) with the JSON string 
received from login view's response. I tried using event.preventDefault() 
as suggested by many answer on SO but could not make it work. Any clue as 
to what is going wrong here? I don't think this to be a Django issue. I 
know that the onsubmit is triggerred because the window redirects to the 
POST handler URL /users/login/ with the expected JSON string response(i.e. 
JsonResponse) - {"error": ["Entered mobile number is not registered"]}

   Please check this stackoverflow link 
<http://stackoverflow.com/questions/31262427/django-jquery-ajax-submit-form-post-request-refreshes-the-page>
 
for the code and complete details. Thanks.

-- 
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+unsubscr...@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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4b5520d2-d057-4f48-a5fe-52d2c2503b66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to