Ajax格式
$.ajax({
type: “get”,
data: {type: typeStr},
async: false, //同步请求
url: url.OnLineStatus,
timeout: 1000,
success: function (data) {
$("#OnLineStatus").html(data.data);
},
error: function () {
// alert(“失败,请稍后再试!”);
}
});
添加函数
function add(id){
layer.confirm(‘您要录信息吗?’, {
btn: [‘YES’,‘NO’] //按钮
}, function(){
layer.open({
type: 0,
title: ‘您的解决方法:’,
content: tpl.bind($(’#amount_tpl’), {id: id}),
yes: function (index, layero) {
$(’#amount_form’).trigger(‘submit’);
}, success: function (layero, index) {
$(’#amount_form’).validator({
valid: function (form) {
$.ajax({
type: ‘post’,
url: g.ctx + ‘/admin/member/callback/updateCallback2/’ + id,
data: $(form).serialize(),
beforeSend: function () {
layer.closeAll();
},
success: function (data) {
if (data.status == ‘OK’) {
layer.msg(data.msg);
window.location.reload();
} else {
layer.tips(data.msg);
}
}
});
}
});
}
})
}, function(){
layer.msg(‘也可以这样’, {
time: 20000, //20s后自动关闭
btn: [‘明白了’, ‘知道了’]
});
});
}