jquery - Why isn't ajax updating my text field on this form? -
i have "resend activation" form on site. visitor enters email address , resent original activation email.
the problem is, if enter email address , click submit, enter different email address (i.e. mis-typed original email) still uses first input.
here's code:
// ***************************************************** // check form when trying resend activation // ***************************************************** $('#form-resend-activation').on('submit', function(e){ $('#formtitletext').text(ajax_login_object.loadingmessage); var error = false; // declare function variables - parent form, form url , regex checking email var emailreg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; // start validation selecting inputs class "required" if($('#username').val() == ''){ $('#username').addclass('error'); $('#formtitletext').text("please enter email address"); error = true; } // run email validation using regex input items having class "email" if(!emailreg.test($('#username').val())){ $('#username').addclass('error'); $('#formtitletext').text("enter valid email address"); error = true; } // validation complete - check whether errors exist - if not submit form if (!error) { $.ajax({ type:"post", datatype: 'json', url:ajax_login_object.themefolder+ajax_login_object.auxfunctionsfolder+"/check_login_details.php", data: { 'username': $('#username').val(), 'originatingpage': ajax_login_object.redirecturl, 'resend_activation': true, 'security': $('#security').val() }, success:function(data){ if(data.done_successfully == true) { // has happened $('#formtitletext').html("<div class='login_message_box'><img src='"+ajax_login_object.themefolder+"/images/loginbox/tick.png' class='jtloginformimage'> "+data.message+"</div>"); } else { // has not happened because aren't in database $('#formtitletext').html("<div class='login_message_box'><img src='"+ajax_login_object.themefolder+"/images/loginbox/cross.png' class='jtloginformimage'> "+data.message+"</div>"); } } }); } e.preventdefault(); }); // ***************************************************** // end of resend activation form // *****************************************************
if has ideas regarding ears. i'm newbie jquery finding way through it. many thanks
john ;-)
Comments
Post a Comment