标签:class const fun url ajax log new function div
let ajax=function(url, param, type = ‘GET‘){ const promise = new Promise(function(resolve, reject){ $.ajax({ type: type, url: url, data: param, dataType: ‘json‘, success(res) { resolve(res) }, error(res) { reject(‘响应错误‘) // reject(res.statusText) } }) }) return promise } // 使用示例 ajax(‘http://wh.xhd.cn/api/content/list.jspx‘,{channelIds: 1}).then(res=>{ console.log(res) })
标签:class const fun url ajax log new function div
原文地址:https://www.cnblogs.com/nanacln/p/11174840.html