anxiao_web/pages/cmddispatch/api/ajax.js

20 lines
364 B
JavaScript
Raw Normal View History

2024-07-24 09:22:32 +08:00
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);
}
})
})
}