wuhu-torn-helper/src/func/utils/jQueryAjax.ts
2022-09-14 18:14:52 +08:00

15 lines
409 B
TypeScript

// 包装jquery ajax异步 返回string
export default function jQueryAjax(url: string, method: 'GET' | 'POST'): Promise<string> {
return new Promise((res, rej) => {
$.ajax({
method: method,
url: url,
success: function (data) {
res(data)
},
error: function (e) {
rej(e)
}
});
});
}