jQuery .ajax submit not working in IE and Chrome -


on of pages such this one when click "have question" button left column form comes through jquery tools overlay. fill out form, submits php script (a local one) , if validates , submits either thank or error message depending on response server. works great in ff, safari , opera, not in ie or chrome. ie , chrome go , print return message .ajax looks on blank page script url. must have incorrect cross domain curl ajax scripting works not this! here code

$(document).click(function() {         $.validator.methods.equal = function(value, element, param) {         return value == param;     };     var validator = $("#request").bind("invalid-form.validate", function() {             $("#summary").html("your form contains " + validator.numberofinvalids() + " error(s), please fix.");         }).validate({             //debug: true,             errorelement: "em",             errorcontainer: $("#summary"),             errorplacement: function(error, element) {                 error.appendto( element.parent("li"));             },             success: function(label) {                 label.text("ok!").addclass("success");             },             submithandler: function(form) {                 $("#processing").show();             var datastring = $(form).serialize();                 $.ajax({                 type: $("#request").attr('method'),                 url: form.action,                 data: datastring,                 clearform: true,                 success: function(data) {                     if (data=="successmail sent") {                         $("#formwrap, #supporthdln").hide();                             $("#thankyou").html('<h2><span>thank you</span> have received request.</h2><p>a customer service representative ninjatrader contact shortly.</p>').fadein("slow");                         } else {                             $("#formwrap, #supporthdln").hide();                             $("#error").html('<h2><span>uh oh</span> unable process request.</h2><p>please make sure fields filled out correctly. if still having trouble, please <a href=\"mailto:support@ninjatrader.com?subject=support email\">email us</a></p>').fadein("slow");                     }                     }                 });             return false;             },             rules: {                     hs_customer_firstname: {                     required: true,                     minlength: 2                 },                     hs_customer_lastname: {                     required: true,                     minlength: 2                 },                     hs_customer_email: {                     required: true,                     email: true                 },                     confirmemail: {                     required: true,                     email: true,                     equalto: "#hs_customer_email"                 },                     hs_customer_phone: {                     required: false,                     digits: true                 },                     hs_category: {                     required: true                       },                     hs_customlargetextfield: {                     required: true,                     minlength: 20                 },                     math: {                     required: true,                     equal: <?php echo $randomnumtotal; ?>                    }             },              messages: {                 hs_customer_firstname: {                     required: "please enter first name",                     minlength: "your first name must @ least 2 characters"                 },                 hs_customer_lastname: {                     required: "please enter last name",                     minlength: "your last name must @ leaset 2 characters"                 },                 hs_customer_email: {                     required: "please enter email address",                     email: "please enter valid email address"                 },                 confirmemail: {                     required: "please confirm email address",                     email: "please enter valid email address",                     equalto: "please enter same email address above"                 },                 hs_customer_phone: {                     digits: "numbers only"                 },                  hs_category:  {                     required: "please select category"                 },                 hs_customlargetextfield: {                     required: "please leave comment",                     minlength: "your comment must @ least 20 characters"                 },                 math: {                     required: "please solve problem",                     equal: "please solve problem correctly"                 }             }         });     }); 

and here's tiny php script runs it

<?php  if(empty($_post['hs_customer_firstname']) || empty($_post['hs_customer_lastname']) || empty($_post['hs_customer_email']) || empty($_post['hs_category']) || empty($_post['hs_customlargetextfield']) || empty($_post['math'])) { echo ('success'); }  $headers = 'from: webmaster@ninjatrader.com' . "\r\n" .        'reply-to: webmaster@ninjatrader.com' . "\r\n" .  $firstname = $_post['hs_customer_firstname'] ; //more  mail( "email@domain.com", "support request", //$_post fields  "from: $email"); if(mail($firstname, $lastname, $email, $category, $inquiry)) { echo ('mail sent'); } else { echo ('error: mail failed'); }  ?> 

it had random number validation, ie , chrome didn't in js code. once got rid of that, , removed validation form page being brought in overlay, added parent page separate js file worked. not sure why random num total doesn't work though. when added php function parent page, didn't trigger js error in validation, numbers didn't validate when added them correctly. oh well, win lose some.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -