Javascript/jquery won't submit form on IE7-9

-.PlAyAh198.-

New Member
I have this fancybox popup script, based on this tutorialFor some reason everything runs fine on Chrome, Firefox, even IE10 for example, but it doesn't execute on IE7-9. There it doesnt move from Sending, please wait to finished message(see below) and email never comes.<script type="text/javascript"> function validateEmail(email) { var reg = /^(([^<>()[\]\\.,;:\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]{2,}))$/; return reg.test(email); } $(document).ready(function() { $(".modalbox").fancybox(); $("#contact").submit(function() { return false; }); $("#send").on("click", function(){ var emailval = $("#email").val(); var msgval = $("#msg").val(); var mailvalid = validateEmail(emailval); var msglen = msgval.length; if(mailvalid == false) { $("#email").addClass("error"); } else if(mailvalid == true){ $("#email").removeClass("error"); } if(msglen < 2) { $("#msg").addClass("error"); } else if(msglen >= 2){ $("#msg").removeClass("error"); } if(mailvalid == true && msglen >= 2) { // if both validate we attempt to send the e-mail // first we hide the submit btn so the user doesnt click twice $("#send").replaceWith("<p><strong>Sending, please wait...</strong></p>"); $.ajax({ type: 'POST', url: '<URL HERE>/sendmessage.php', data: $("#contact").serialize(), success: function(data) { if(data =http://stackoverflow.com/questions/13804340/="true") { $("#contact").fadeOut("fast", function(){ $(this).before("<p><strong>Thank you, your message has been sent. We will be in touch shortly.</strong></p>"); }); } } }); } }); });</script>And this is the sendmessage.php:<?phpheader('Access-Control-Allow-Origin: *'); $sendto = "<email>";$usermail = $_POST['email'];$content = nl2br($_POST['msg']);$subject = "Upgrade Request";$headers = "From: " . strip_tags($usermail) . "\r\n";$headers .= "Reply-To: ". strip_tags($usermail) . "\r\n";$headers .= "MIME-Version: 1.0\r\n";$headers .= "Content-Type: text/html;charset=utf-8 \r\n";$msg = "<html><body style='font-family:Arial,sans-serif;'>";$msg .= "<h2 style='font-weight:bold;border-bottom:1px dotted #ccc;'> Upgrade Request</h2>\r\n";$msg .= "<p><strong> Email:</strong> ".$usermail."</p>\r\n";$msg .= "<p><strong> Customer ID:</strong> ".$id."</p>\r\n";$msg .= "<p><strong> Username:</strong> ".$pb."</p>\r\n";$msg .= "<p><strong>Deposit:</strong> ".$content."</p>\r\n";$msg .= "</body></html>";if(@mail($sendto, $subject, $msg, $headers)) { echo "true";} else { echo "false";}?>
 
Back
Top