所需要的js:
jquery.min.js;
jquery.form.js。
html:
<form>
<input type="text" name="title" />
<button>提交</button>
</form>
jq:
$('button').click(function () {
var title = $('inpur[name=title]').val(),
content = $('textarea').val();
/* $(this).ajaxSubmit({
type: 'post', // 提交方式 get/post
url:url, // 需要提交的 url
data: {
'title': title,
'content': content
},
success: function(data) { // data 保存提交后返回的数据,一般为 json 数据
alert('提交成功!');
}
});*/
ajaxSubmit("url", {
'title': title,
'content': content
}, function(returnData) {
if ("success" == returnData.status) {
} else {
}
});
});