15 lines
409 B
TypeScript
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)
|
|
}
|
|
});
|
|
});
|
|
} |