为什么这个javascript函数不适用于ie7和8?
当用户点击按钮时,它会显示PLEASE WAIT....
并隐藏然后显示TEST
我在firefox和chrome上测试,没关系
但是不能在IE7和8上工作,我该怎么做?
的index.php
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<form id="myForm" name="send_ask" action="test_e.php" method="post">
<button id="sub">Send</button>
<span id="loading" style="display:none;">PLEASE WAIT.......</span>
<span id="result" style="display:none;"></span>
</form>
<script type="text/javascript">
$('#myForm').submit(function(e){
e.preventDefault();
$.ajax({
url: $("#myForm").attr("action"),
data: $("#myForm :input").serializeArray(),
type: 'post',
dataType: 'html',
success: function(data){
$("#result").html(data);
},
beforeSend: function(){
document.getElementById("sub").disabled = true;
document.getElementById("loading").style.display="inline";
$("#result").hide()
},
complete: function(data){
$("#result").show()
}
});
});
</script>
test_e.php
TEST
答案 0 :(得分:1)
我首先看到的是,如果按钮不是提交按钮,那么不确定其他人是如何提交表单的。
<button id="sub" type="submit">Send</button>