function Ajax(url, params) { return new Promise((resolve, reject) => { $.ajax({ url: url , type: 'post' , data: params , success: res => resolve(res) ,fail:res=>reject(res) }); }); }
调用
Ajax('OnAdd', data).then((res) => { console.log(res); });
标签:封装,url,res,Ajax,JS,ajax,params From: https://www.cnblogs.com/ThisYbc/p/16880878.html