<form id="yourformid" >
<input type="text" name="yanz">
<input type="text" name="qwe">
<input type="text" name="ert">
<button type="button" id="sub">提交</button>
</form>
<script>
$(function () {
$("#sub").click(function () {
$.ajax({
cache: true,
type: "POST",
url:"{:url('yana')}",
data:$('#yourformid').serialize(),// 你的formid
async: false,
error: function(request) {
alert("Connection error");
},
success: function(data) {
alert(data.msg);
}
});
}
);
});
posted on 2017-06-15 15:39  shjphp  阅读(85)  评论(0)    收藏  举报