I have 3 fields in my ajax registration form. Each of them under success has:
success: f开发者_C百科unction (j) {
if (j.ok){
$(validateEmail.html(j.msg)).attr("id","accept").appendTo($('#loginform') );
} else {
$(validateEmail.html(j.msg)).attr("id","invalid").appendTo($('#loginform') );
}
}
When the field is validated and put in correctly (i.e. password which must have 8 letters HAS 8 letters, the php sends back a JSON message of j.ok = 'true'
Is there a way to under
$('#register').click(function() {
//insert code here
});
to check that all of the j.ok"s are marked as true?
Thanks
As Peter said, don't use valid/invalid as ID. Maybe you want to use classes instead, or jquery's .data().
Then, maybe you can make a counter?
var count = 0;
...
if(j.ok) {
stuff;
count = count+1;
}
Then you check:
if(count == 3) {
allvalid;
}
Regards.
精彩评论