$.post("include/email_validate.inc.php", {
email: $('#email').val()
}, function(response){
if(response=="email_exits")
{
alert("E-mail Address Already Registered");
return false;
}
else if(response=="invalid_email")
{
alert("Invalid E-mail Address" );
return false;
}
});
Can you explain the above code? I think it is related with validation. What I am not understanding is specifically this line...
$.post("include/email_validate.inc.php", { email: $('#email').val() }, function(response)
Please tell me what this code is doing?
That line is jQuery code to send an AJAX bosed request. Check out the jQuery manual on $.post for more information on that function.
Specifically, this code seems to send a request to the server containing an email address, and receive a response based on whether that email is unique and/or valid. Technically, this code could do anything because we can't see the PHP handler or expected input, but the messages suggest e-mail validation and storage.
Note: The email address it sends will be in the input box that has X/HTML looking something like this:
<input type="text" name="email" id="email" />
Actually, that little title is misleading; there is no more info we can give you. This code relies heavily on some backend code which we cannot see. You must check the contents of include/email_validate.inc.php
for more information (feel free to post the contents of this file, just make sure to remove any database username or password info), but without doing so this is as much information as anyone here can hope to give you.