anxiao_web/pages/video/api/ajax.js

21 lines
365 B
JavaScript

export function ajax(url,data,type="post"){
return new Promise((resolve,reject)=>{
$.ajax({
url:url,
type:type,
dataType:"json",
data:JSON.stringify(data),
headers:{
"Content-Type":"application/json;charset=utf-8",
},
success:function(resData){
resolve(resData);
},
error:function(error){
reject(error);
}
})
})
}