1

This works in all browsers, I've seen similiar "IE 9 is not working posts." This one is a bit difference I guess because I'm doing something pretty basic.

Everything is working fine in all browsers except IE 9 which doesn't even send the data to my mail.php page.

Help is greatly appreciated.

Submit Code:

$(function() { $(".submit").click(function() { var name = $("input#name").val(); var email = $("input#email").val(); var topic = $("select#topic").val(); var message = $("textarea#message").val(); var dataString = 'name='+ name + '&email=' + email + '&topic=' + topic + '&message=' + message; $.ajax({ type: "POST", url: "http://***.***/***/mail.php", data: dataString, success: function() { $('.holder').hide(); $('#callback').show().append("Your feedback is appreciated, thank you!"); }, error:function(){ alert(dataString); $('.holder').hide(); $('#callback').show().append("There was an error processing your request, we're very sorry please try again later."); } }); return false; }); }); 

Here is the HTML (I've used * to hide data):

<!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <link rel="stylesheet" href="contactable.css" type="text/css" /> <script src="jquery.js"></script> </head> <body> <div id="contactable"> <div id="contactable_inner"></div> <div id="carFeedbackForm"> <div id="close"><u>Close</u></div> <form id="contactForm" action=""> <div id="loading"></div> <div id="callback"></div> <div class="holder"> <p><label for="name">Name<span class="red"> * </span></label><br /> <input id="name" class="contact" name="name"/></p> <p><label for="email">Email <span class="red"> * </span></label><br /> <input id="email" class="contact" name="email" /></p> <p><label for="topic">Topic&nbsp</label><select id="topic" class="contact" name="topic"> <option>I Like</option> <option>I Dislike</option> <option>Cannot login</option> <option>***(R)</option> <option>Broken Link</option> <option>Other</option></select></p><br /> <p><label for="message">Message <span class="red"> * </span></label><br /> <textarea id="message" name="message" class="message" rows="4" cols="30" ></textarea></p><br> <p class="disclaimer">We are always interested in hearing from you. Your feedback will help us improve your online experience.</p> <p><input class="submit" type="submit" value="Send"/></p> </div></div></form> 
2
  • Can you post your HTML too? specifically your code dealing with any form opening tag, and whatever have the class "submit". My theory is that IE is seeing what you are doing as attempting to hijack the submit button or image, which it will not allow. Interestingly your code probably would run if you moved it to the onSubmit of your form element. Commented Nov 3, 2012 at 1:06
  • I've added the HTML. Thanks for the help. I want to be able to submit this form dynamically without a page reload. Commented Nov 5, 2012 at 20:26

2 Answers 2

0

Try to use the object notation for your post parameters:

var data = { name: $("input#name").val(), email: $("input#email").val(), topic: $("select#topic").val(), message: $("textarea#message").val() }; $.ajax({ ... data: data, ... }); 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for sharing, I tried that, same results as before, working in everything but I.E. 9
0

I'm pretty sure this is your problem , and have seen other people with the same problem solve it with encoding the data properly for the url. See encodeURIComponent

your code

 var dataString = 'name='+ name + '&email=' + email + '&topic=' + topic + '&message=' + message; 

what if name is "my name" , this will break in IE9, other browsers encode string automatically try that before sending the data

3 Comments

I had high hopes for this, thanks for the response. Nothing went different but I'll remember this one. I placed the site on the same server as mail.php and it worked fine. The funny thing is the FF was working but would think it failed until I added the header info to accept posts from my domain. IE was working before that up until I started using Ajax
I'll put this in the answer, here is what worked. I set the data type to script and now it works fully. I'd love to know more about why, I pulled my hair out for a couple days. I prior had to add headers for cross domain to allow FF to work but IE9... I want to know more so I don't do this every time.
Update: I'm not figuring out a solution to getting my mail site to work with IE9, the mail is coming in blank

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.