hi there
guys, i need your help. can you please give me some simple codes in validating a registration form using ajax? please...
:-(
I'm a beginner. i need your help guys.
hi there
guys, i need your help. can you please give me some simple codes in validating a registration form using ajax? please...
:-(
I'm a beginner. i need your help guys.
I found this with google - http://jqueryfordesigners.com/using-ajax-to-validate-forms/
Seems to be a good one.
If you're testing something like a username, to see whether it exists (I assume this would be the reason for javascript) - Just format your response in a specific way ie
If username/email is ok: "OK", if not "FAIL" - then (my code is jQuery based because it's alot easier to write than straight javascript)
$("input[name='emailAddress']").onblur(function() {
$.ajax({
url:"/checkemailaddress?email="+$(this).val(),
success: function(response) {
if(response=="OK"){
$(this).removeClass("RedCross").addClass("GreenTick");
} else {
$(this).removeClass("GreenTick").addClass("RedCross");
}
}
});
});
Codes not tested by the way!
Refer this link...a good explaination provioded for all client side validations using AJAX.
http://java.sun.com/developer/technicalArticles/J2EE/AJAX/RealtimeValidation/