Jquery and PHP

HI, right now I have a code on my homepage reesecodes.com in the subscribe to newsletter where I use regex to verify whether or not someone enters in a valid email address. How can I use jquery to activate when the PHP validates the email address as real email address so I can display a div (and display:none on the form) saying thank you for subscribing? Here is my JS code and PHP code. I have the display block css in there but since it reloads the page because it posts to the PHP page in the form, the div doesn’t display, so I need a fresh approach

[code]$(function() {
$(“#contact_button”).click(function() {
// form variables
var email = $(“input#email”).val();

// form validation
if(email==‘’) {

Insert The E-Mail Please.
return false;
else {
// AJAX functions
type: “POST”,
url: “ajax-contact.php”,
data: dataString,
cache: false,
success: function(html){
if (html == 1) {
$(“#response”).css(‘display’, ‘block’);
} else {
Error Happened. Please Try Again Later.
return false;

[code]function validateEmail(email) {
var re = /^(([^<>() \.,;:\s@"]+(.[^<>() \.,;:\s@"]+)*)|(".+"))@(([[0-9] {1,3}.[0-9] {1,3}.[0-9] {1,3}.[0-9] {1,3}])|(([a-zA-Z-0-9] +.)+[a-zA-Z]

return re.test(email);

$recipient = “ericreese20@gmail.com”;
$subject = “Subscribe”;

$location = “…/index.html”;

$sender = $recipient;
$body .= “Email: “.$_REQUEST[‘Email’].” \n”;

mail( $recipient, $subject, $body, “From: $sender” ) or die (“Mail could not be sent.”);

header( “Location: $location” );

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.