|
@@ -118,3 +118,29 @@ var CommonAjax = {
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+async function ajaxPost(url, data) {
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ $.ajax({
|
|
|
+ type:"POST",
|
|
|
+ url: url,
|
|
|
+ data: {'data': JSON.stringify(data)},
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ timeout: 50000,
|
|
|
+ success: function(result){
|
|
|
+ if (result.error === 0) {
|
|
|
+ resolve(result.data);
|
|
|
+ } else {
|
|
|
+ alert('error: ' + result.message);
|
|
|
+ reject(result.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(jqXHR, textStatus, errorThrown){
|
|
|
+ ajaxErrorInfo(jqXHR, textStatus, errorThrown);
|
|
|
+ reject("请求错误");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+}
|