python - jQuery remote validate not showing an error message DJango -
i using jquery remote validation check whether email available register calling django view.
views.py
def check_email(request):   is_available = "false"   if request.is_ajax():     username = request.post.get("username")     try:          user.objects.get_by_natural_key(username)     except user.doesnotexit:        is_available = "true"   return httpresponse(is_available)   url.py
    url(r'^check_email/$', 'app.views.check_email', name='check_email')   jquery
{$( "#myform" ).validate({ rules: {     email: { remote: "check-email/" } } messages: {    email: {remote: "the email taken."} } });   the jquery code not rendering error message. missing? thanks.
def check_email(request):     is_available = "false"     if request.is_ajax():         username = request.get.get("username") # change post         try:              user.objects.get_by_natural_key(username)         except user.doesnotexit:             is_available = "true"     return httpresponse(is_available)   and
$( "#myform" ).validate({     rules: {         email: {              remote: "/check-email/",             type: "get", // method         }     }, // add comma     messages: {        email: {remote: "the email taken."}     } });      
Comments
Post a Comment