=====HTML事例=====
<form action="detail.php" method="post" name="form" id="form">
<input type="text" name="ac" value="ajaxSendEmail">
<a href="javascript:void(0);" id="sendbtn" > 发送 </a>
</form>
====js====
<script src="/jquery.js"></script>
<script src="/ajaxfrom.js"></script>
<script>
$().ready(function(){
//初始化ajaxForm
var options = {
beforeSubmit : showRequest,
success : showResponse,
type : 'POST'
};
$('#form').ajaxForm(options);
//提交
$('#sendbtn').click(function(){
$('#form').submit();
});
//请求方法
function showRequest(formData, jqForm, options){
//alert('About to submit: \n\n' + $.param(formData));
return true;
}
//处理方法
function showResponse(responseText, statusText, xhr, $form){
//alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\nThe output div should have already been updated with the responseText.');
art.dialog({
id : 'ajaxedit',
content : responseText,
ok : function(){
art.dialog.list['ajaxedit'].close();
}
});
}
</script>