Jquery Form Plugin Breaking in IE

Jquery Form Plugin Breaking in IE

Hello all,

I'm trying to implement the jquery form plugin for a client. The form is working in Chrome, but in IE(11) it's not working. 

I've looked through the core as much as i can but can't seem to figure it out.

HTML:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Agent Submission Form For Auto Glass Repair &amp; Replacement</title>
  6. <link href="css/layout.css" type="text/css" rel="stylesheet" media="screen" />
  7. <link href="css/form.css" type="text/css" rel="stylesheet" media="all" />
  8. </head>
  9. <body>
  10.         <form role="ajaxExample" method="post" action="" enctype="multipart/form-data" id="agents">
  11.                   <div id="response"></div>
  12.           <table cellpadding="2" cellspacing="3">
  13.           <tr>
  14.             <td><strong>Customer Information:</strong></td>
  15.               <td>&nbsp;</td>
  16.               <td><strong>Vehicle Information:</strong></td>
  17.               <td>&nbsp;</td>
  18.             </tr>
  19.           <tr>
  20.             <td>
  21.             <label for="name">Name:</label>
  22.               </td>
  23.               <td>
  24.            <input type="text" name="cusName" id="cusName" tabindex="1">
  25.               </td>
  26.               <td><label for="year">Year:</label></td>
  27.               <td>
  28.               <select name="year" id="year" tabindex="9">
  29.                   <option value="">Select Year...</option>
  30. <?php
  31.                   for ($x = date("Y") + 1; $x >= 1962; $x--)  
  32.                   {

  33.                       echo '<option value="'.$x.'"'.'>'.$x."</option>";

  34.                   }
  35. ?>                  
  36.               </select>
  37.               </td>
  38.             </tr>
  39.             <tr>
  40.             <td><label for="address">Address:</label></td>
  41.               <td><input type="text" name="cusAddress" id="cusAddress" tabindex="2" /></td>
  42.               <td><label for="make">Make:</label></td>
  43.               <td><input type="text" name="make" id="make" tabindex="10" /></td>
  44.             </tr>
  45.             <tr>
  46.             <td><label for="city">City:</label></td>
  47.               <td><input type="text" name="city" id="city" tabindex="3" /></td>
  48.               <td><label for="model">Model:</label></td>
  49.               <td><input type="text" name="model" id="model" tabindex="11" /></td>
  50.             </tr>
  51.             <tr>
  52.             <td><label for="state">State:</label></td>
  53.               <td><input type="text" name="state" id="state" tabindex="4" /></td>
  54.               <td><label for="bodyStyle">Body Style:</label></td>
  55.               <td>
  56.               <select name="bodyStyle" id="bodyStyle" tabindex="12">
  57.                 <option value="" selected="selected">Select...</option>
  58.                   <option value="2 Door">2 Door</option>
  59.                   <option value="4 Door">4 Door</option>
  60.                   <option value="Wagon">Wagon</option>
  61.                   <option value="Hatchback">Hatchback</option>
  62.                   <option value="Other">Other</option>
  63.                 </select>
  64.               </td>
  65.             </tr>
  66.             <tr>
  67.             <td><label for="zip">Zip Code:</label></td>
  68.               <td><input type="text" name="zip" id="zip" tabindex="5" /></td>
  69.               <td><label for="vin">VIN Number:</label></td>
  70.               <td><input type="text" name="vin" id="vin" maxlength="17" tabindex="13" /></td>
  71.             </tr>
  72.             <tr>
  73.             <td><label for="homePhone">Home Phone:</label></td>
  74.               <td><input type="text" name="homePhone" id="homePhone" tabindex="6" /></td>
  75.               <td><label for="damagedGlass">Damaged Glass:</label></td>
  76.               <td><input type="text" name="damagedGlass" id="damagedGlass" tabindex="14" /></td>
  77.             </tr>
  78.             <tr>
  79.             <td><label for="workPhone">Work Phone:</label></td>
  80.               <td><input type="text" name="workPhone" id="workPhone" tabindex="7" /></td>
  81.               <td></td>
  82.               <td></td>
  83.             </tr>
  84.             <tr>
  85.             <td><label for="cellPhone">Cell Phone:</label></td>
  86.               <td><input type="text" name="cellPhone" id="cellPhone" tabindex="8" /></td>
  87.               <td></td>
  88.               <td></td>
  89.             </tr>
  90.             <tr>
  91.             <td colspan="4">&nbsp;</td>
  92.             </tr>
  93.             <tr>
  94.             <td><strong>Insurance Information:</strong></td>
  95.               <td></td>
  96.               <td></td>
  97.               <td></td>
  98.             </tr>
  99.             <tr>
  100.             <td><label for="insCompany">Ins. Company:</label></td>
  101.               <td><input type="text" name="insCompany" id="insCompany" tabindex="15" /></td>
  102.               <td><label for="agency">Agency</label></td>
  103.               <td><input type="text" name="agency" id="agency" tabindex="20" /></td>
  104.             </tr>
  105.             <tr>
  106.             <td><label for="policy">Policy#:</label></td>
  107.               <td><input type="text" name="policy" id="policy" tabindex="16" /></td>
  108.               <td><label for="sentBy">Sent By:</label></td>
  109.               <td><input type="text" name="sentBy" id="sentBy" tabindex="21" /></td>
  110.             </tr>
  111.             <tr>
  112.             <td><label for="compCoverage">Comp. Coverage:</label></td>
  113.               <td><input type="radio" name="compCoverage" id="compCoverage" value="YES" tabindex="17" />&nbsp;Yes&nbsp;&nbsp;&nbsp;<input type="radio" name="compCoverage" id="compCoverage" tabindex="18" />&nbsp;No</td>
  114.               <td><label for="deductible">Deductible:</label></td>
  115.               <td><input type="text" name="deductible" id="deductible" tabindex="22" /></td>
  116.             </tr>
  117.             <tr>
  118.             <td><label for="dateOfLoss">Date Of Loss:</label></td>
  119.               <td><input type="text" name="dateOfLoss" id="dateOfLoss" tabindex="19" /></td>
  120.               <td><label for="causeOfLoss">Cause Of Loss</label></td>
  121.               <td><input type="text" name="causeOfLoss" id="causeOfLoss" tabindex="23" /></td>
  122.             </tr>
  123.             <tr>
  124.             <td colspan="4">&nbsp;</td>
  125.             </tr>
  126.             <tr>
  127.             <td colspan="4">&nbsp;</td>
  128.             </tr>
  129.             <tr>
  130.               <td colspan="2" align="right"><label for="replyEmail">Reply Email Address:</label></td>
  131.               <td colspan="2"><input type="text" name="replyEmail" id="replyEmail" tabindex="24" /></td>
  132.             </tr>
  133.             <tr>
  134.             <td colspan="4">&nbsp;</td>
  135.             </tr>
  136.             <tr>
  137.             <td colspan="4">&nbsp;</td>
  138.             </tr>
  139.             <tr>
  140.             <td colspan="2"><label for="specialInstructions">Are There Any Special Instructions?</label></td>
  141.               <td colspan="2"><textarea name="specialInstructions" id="specialInstructions" cols="38" rows="6" tabindex="25"></textarea></td>
  142.             </tr>
  143.             <tr>
  144.             <td colspan="4">&nbsp;</td>
  145.             </tr>
  146.             <tr>
  147.             <td colspan="2" align="right">Anti-spam... Please Solve The Math Problem:</td>
  148.               <td colspan="2">
  149. <?php
  150. $a = rand(1, 10);
  151. $b = rand(1, 10);
  152. echo $a." + ".$b." = ?";
  153. ?>
  154.                     <input type="hidden" value="<?php echo $a;?>" name="value1" />
  155.                     <input type="hidden" value="<?php echo $b;?>" name="value2" /> </td>
  156.             </tr>
  157.             <tr>
  158.               <td>&nbsp;</td>
  159.               <td>&nbsp;</td>
  160.               <td colspan="2"><input type="text" name="answer" value="what's the result?" onclick="this.value=''" tabindex="26" /></td>
  161.             </tr>
  162.             <tr>
  163.             <td colspan="4">&nbsp;</td>
  164.             </tr>
  165.             <tr>
  166.             <td colspan="2"><input type="hidden" name="honeypot" id="honeypot" value="http://"></td>
  167.               <td colspan="2"><input type="hidden" name="humancheck" id="humanCheck" class="clear" value=""></td>
  168.             </tr>
  169.             <tr>
  170.             <td colspan="4">&nbsp;</td>
  171.             </tr>
  172.             <tr>
  173.             <td colspan="4" align="center"><button type="submit" name="submit" id="submit" tabindex="27">Submit Claim</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value="Reset Form" tabindex="28" /></td>
  174.             </tr>
  175.           </table>
  176.           <div id="response"></div>
  177.       </form>
  178. </body>
  179. <script src="js/jquery.min.js" type="text/javascript"></script>
  180. <script src="js/ajax_submit.js" type="text/javascript"></script>

  181. </html>
PHP
  1. <?php 
  2. sleep(.5);
  3. //Sanitize incoming data and store in variable

  4. //customer info
  5. $name = trim(stripslashes(htmlspecialchars($_POST['cusName'])));  
  6. $address = trim(stripslashes(htmlspecialchars($_POST['cusAddress'])));
  7. $city = trim(stripslashes(htmlspecialchars($_POST['city'])));
  8. $state = trim(stripslashes(htmlspecialchars($_POST['state'])));
  9. $zip = trim(stripslashes(htmlspecialchars($_POST['zip'])));
  10. $homePhone = trim(stripslashes(htmlspecialchars($_POST['homePhone'])));
  11. $homePhoneLink = preg_replace('/\D+/', '', $homePhone);
  12. $workPhone = trim(stripslashes(htmlspecialchars($_POST['workPhone'])));
  13. $workPhoneLink = preg_replace('/\D+/', '', $workPhone);
  14. $cellPhone = trim(stripslashes(htmlspecialchars($_POST['cellPhone'])));
  15. $cellPhoneLink = preg_replace('/\D+/', '', $cellPhone);

  16. //vehicle info
  17. $year = trim(stripslashes(htmlspecialchars($_POST['year'])));
  18. $make = trim(stripslashes(htmlspecialchars($_POST['make'])));
  19. $model = trim(stripslashes(htmlspecialchars($_POST['model'])));
  20. $bodyStyle = trim(stripslashes(htmlspecialchars($_POST['bodyStyle'])));
  21. $vin = trim(stripslashes(htmlspecialchars($_POST['vin'])));
  22. $damagedGlass = trim(stripslashes(htmlspecialchars($_POST['damagedGlass'])));

  23. //insurance info
  24. $insCompany = trim(stripslashes(htmlspecialchars($_POST['insCompany'])));
  25. $agency = trim(stripslashes(htmlspecialchars($_POST['agency'])));
  26. $policy = trim(stripslashes(htmlspecialchars($_POST['policy'])));
  27. $sentBy = trim(stripslashes(htmlspecialchars($_POST['sentBy'])));
  28. $compCoverage = trim(stripslashes(htmlspecialchars($_POST['compCoverage'])));
  29. $deductible = trim(stripslashes(htmlspecialchars($_POST['deductible'])));
  30. $dateOfLoss = trim(stripslashes(htmlspecialchars($_POST['dateOfLoss'])));
  31. $causeOfLoss = trim(stripslashes(htmlspecialchars($_POST['causeOfLoss'])));
  32. $replyEmail = trim(stripslashes(htmlspecialchars($_POST['replyEmail'])));
  33. $specialInstructions = trim(stripslashes(htmlspecialchars($_POST['specialInstructions'])));

  34. //spam filters
  35. $humancheck = $_POST['humancheck'];
  36. $honeypot = $_POST['honeypot'];
  37. $answer = $_POST['answer'];
  38. $c = $_POST['value1'] + $_POST['value2'];

  39. if ($honeypot == 'http://' && empty($humancheck)) {
  40. //Validate data and return success or error message
  41. $error_message = '';
  42. $reg_exp = "/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,4}$/";
  43. if (empty($name)) {
  44.    $error_message .= "<p>CUSTOMER NAME IS REQUIRED.</p>";   
  45. }
  46. if ($answer != $c) {
  47. $error_message .= "<p>PLEASE RE-ENTER YOUR SIMPLE MATH ANSWER AND TRY AGAIN.</p>";
  48. }
  49. /*if (empty($address)) {
  50. $error_message .= "<p>Customer address is required.</p>";
  51. }
  52. if (empty($city)) {
  53. $error_message .= "<p>Customer city is required.</p>";
  54. }
  55. if (empty($state)) {
  56. $error_message .= "<p>Customer state is required.</p>";
  57. }
  58. if (empty($zip)) {
  59. $error_message .= "<p>Customer zip is required.</p>";
  60. }
  61. if (empty($homePhone) || empty($workPhone) || empty($cellPhone)) {
  62. $error_message .= "<p>Please provide at least one phone number for the customer.</p>";
  63. }
  64. if (empty($year)) {
  65. $error_message .= "<p>Vehicle year is required.</p>";
  66. }
  67. if (empty($make)) {
  68. $error_message .= "<p>Vehicle make is required.</p>";
  69. }
  70. if (empty($model)) {
  71. $error_message .= "<p>Vehicle model is required.</p>";
  72. }
  73. if (empty($bodyStyle)) {
  74. $error_message .= "<p>Vehicle body style is required.</p>";
  75. }
  76. if (empty($vin)) {
  77. $error_message .= "<p>Vehicle VIN number is required.</p>";
  78. }
  79. if (empty($damagedGlass)) {
  80. $error_message .= "<p>Vehicle\'s damaged glass is required.</p>";
  81. }
  82. if (empty($insCompany)) {
  83. $error_message .= "<p>Insurance company is required.</p>";
  84. }
  85. if (empty($agency)) {
  86. $error_message .= "<p>Insurance agency is required.</p>";
  87. }
  88. if (empty($policy)) {
  89. $error_message .= "<p>Policy number is required.</p>";
  90. }
  91. if (empty($sentBy)) {
  92. $error_message .= "<p>The \"sent by\" field is required.</p>";
  93. }
  94. if (empty($compCoverage)) {
  95. $error_message .= "<p>Comp Coverage is required.</p>";
  96. }
  97. if (empty($deductible)) {
  98. $error_message .= "<p>Deductible ammount is required.</p>";
  99. }
  100. if (empty($dateOfLoss)) {
  101. $error_message .= "<p>Date of loss is required.</p>";
  102. }
  103. if (empty($causeOfLoss)) {
  104. $error_message .= "<p>Cause of loss is required.</p>";
  105. }*/
  106. if (!preg_match($reg_exp, $replyEmail)) {
  107. $error_message .= "<p>A VANILD REPLY EMAIL ADDRESS IS REQUIRED.</p>";   
  108. }
  109. if (!empty($error_message)) {
  110. $return['error'] = true;
  111. $return['msg'] = '<div class="alert alert-danger">'."<h4>OOPS! THE FORM WAS NOT SUBMITTED.</h4>".$error_message;
  112. echo json_encode($return);
  113. exit();
  114. else {
  115. //mail variables
  116. #$to = 'claims@kkglass.com';
  117. $to = 'Jason@mainstreetcomp.com';
  118. $from = $_POST['replyEmail'];
  119. $headers = 'From: '.$from."\r\n";
  120. $headers .= 'MIME-Version: 1.0' . "\r\n";
  121. $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  122. $subject = "Glass Referral From Website\n";
  123. $body = '<h4>Customer Information</h4>';
  124. $body .= '<p>Name:   '.$name."<br />";
  125. $body .= 'Address: '.$address.'; '.$city.', '.$state.' '.$zip.'<br />';
  126. if(isset ($homePhone) && $homePhone != '') {
  127. $body .= 'Home Phone: '.'<a href="tel:+1'.$homePhoneLink.'">'.$homePhone."</a><br />";
  128. }
  129. if(isset ($workPhone) && $workPhone != '') {
  130. $body .= 'Work Phone: '.'<a href="tel:+1'.$workPhoneLink.'">'.$workPhone."</a><br />";
  131. }
  132. if(isset ($cellPhone) && $cellPhone != '') {
  133. $body .= 'Cell Phone: '.'<a href="tel:+1'.$cellPhoneLink.'">'.$cellPhone."</a><br />";
  134. }
  135. $body .= '</p>';
  136. $body .= '<h4>Vehicle Information</h4>';
  137. $body .= 'Year: '.$year.'<br />';
  138. $body .= 'Make: '.$make.'<br />';
  139. $body .= 'Model: '.$model.'<br />';
  140. $body .= 'Body Style: '.$bodyStyle.'<br />';
  141. $body .= 'VIN: '.$vin.'<br />';
  142. $body .= 'Damaged Glass: '.$damagedGlass.'</p>';
  143. $body .= '<h4>Insurance Information</h4>';
  144. $body .= 'Ins. Company: '.$insCompany.'<br />';
  145. $body .= 'Agency: '.$agency.'<br />';
  146. $body .= 'Policy #'.$policy.'<br />';
  147. $body .= 'Sent By: '.$sentBy.'<br />';
  148. $body .= 'Comp Coverage: '.$compCoverage.'<br />';
  149. $body .= 'Deductible: '.$deductible.'<br />';
  150. $body .= 'Date of Loss: '.$dateOfLoss.'<br />';
  151. $body .= 'Cause of Loss: '.$causeOfLoss.'<br />';
  152. $body .= 'Reply Email: <a href="mailto:'.$replyEmail.'">'.$replyEmail.'</a><br />';
  153. $body .= 'Special Instructions: '.$specialInstructions.'</p>';
  154. //send email and return a message to user
  155. if(mail($to, $subject, $body, $headers)) {
  156. $return['error'] = false;
  157. $return['msg'] = 
  158. '<div class="alert alert-success">'.
  159. "<h4>Thank you for using our form ".$sentBy ."</h4>".
  160. "<p>We'll reply to you at ".$email." as soon as we can.</p>";
  161.  
  162. echo json_encode($return);
  163. }
  164. else {
  165. $return['error'] = true;
  166. $return['msg'] = "<h4>Oops! There was a problem sending the email. Please try again.</h4>";
  167. echo json_encode($return);
  168. }

  169. }
  170. else {
  171. $return['error'] = true;
  172. $return['msg'] = "<h4>Oops! There was a problem with your submission. Please try again.</h4>";
  173. echo json_encode($return);
  174. }
  175. ?> 

and the javascript:

Sorry for just linking the javascript, my post was too long
    Can anyone see what i am missing? I'm pretty new to javascript and nothing is really jumping out at me. Any insight or help is really appreciated!

    Thank you!