下面的代码仅在我取消注释警报时起作用。这段代码有什么问题。
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