下面的代碼僅在我取消註釋警報時起作用。這段代碼有什麼問題。
temp.htmljquery load()僅適用於alert()
<script src="jquery.js" type="text/javascript"></script>
<div id="show"></div>
<form id="chat_form">
<input type="submit" />
</form>
<div id="abc"></div>
<script>
$(document).ready(function() {
$("#chat_form").submit(function (event) {
$("#show").load("test.html", function (responseTxt, statusTxt, xhr) {
if (statusTxt == "success")
$("#abc").text(responseTxt);
if (statusTxt == "error")
$("#abc").text(xhr.statusText);
//alert(xhr.statusText);
});
});
});
</script>
的test.html
<p>hi i am test.html</p>
嘗試阻止默認表單提交操作 - http://jsfiddle.net/arunpjohny/upfjLurm/1/ – 2015-03-03 08:05:26