这适用于所有浏览器,我见过类似的“IE 9 无法正常工作”。我想这有点不同,因为我正在做一些非常基本的事情。
除了 IE 9 甚至没有将数据发送到我的 mail.php 页面之外,所有浏览器都运行良好。
非常感谢您的帮助。
提交代码:
$(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;
});
});
这是 HTML(我用*来隐藏数据):
<!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 </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>