外部调用layui.use内定义的函数需要引入 layui.all.js ,并定义 window.xxx函数
window.ajaxSubmit = function(data,url,type){
$.ajax({
url: url,
data: data,
type: type,
async: false,
success:function(res) {
if(res.code == 1) {
layer.alert(res.msg, function(index){
location.href = res.url;
})
} else {
layer.msg(res.msg);
}
}
});
}