关于ajaxFrom的随手笔记

=====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" >&nbsp;发送&nbsp;</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>

posted @ 2016-01-04 15:21  greadcat  阅读(191)  评论(0编辑  收藏  举报