先引入jqueryform
<script type="text/javascript" src="__PUBLIC__/js/jquery.form.js"></script>
html
<form class="myform " onsubmit="return false;">
<input type="text" name="id" value="{$data.id}">
<input class="btn btn-white" type="submit" id="sub" value="确定">
</form>
js部分
$("#sub").on('click',function () {
$(".myform").ajaxSubmit({
type: "post",
dataType: "json",
success: function (data) {
if (data.status === 1) {
dialog({content: data.info}).showModal();
setTimeout(function () {
window.location.href="{:U('Order/repair')}";
}, 300);
} else {
dialog({title: '友情提示', content: data.info, ok: true}).showModal();
}
}
});
})