當前位置:編程學習大全網 - 網站源碼 - java 如何實現異步提交

java 如何實現異步提交

Ajax,利用jQuery的ajaxform

第壹步:先增加壹個表單

<form id="myForm" action="comment.php" method="post">

Name: <input type="text" name="name" />

Comment: <textarea name="comment"></textarea>

<input type="submit" value="Submit Comment" />

</form>

第二步:jquery.js和form.js文件的包含

<head>

<script type="text/javascript" src="path/to/jquery.js"></script>

<script type="text/javascript" src="path/to/form.js"></script>

<script type="text/javascript">

// wait for the DOM to be loaded

$(document).ready(function() {

// bind 'myForm' and provide a simple callback function

$('#myForm').ajaxForm(function() {

alert("Thank you for your comment!");

});

});

</script>

</head>

  • 上一篇:linuxyum卸載命令linuxyum卸載
  • 下一篇:英雄殺有透視嗎?知道的說下。用過的趕緊過來認罪!
  • copyright 2024編程學習大全網