let jqPostAjaxPromise = function(param){
return new Promise(function(resolve, reject){
$.ajax({
url: param.url,
type: 'post',
data: param.data || '',
dataType: "json",
success: function(data){
resolve(data);
},
error: function(error){
reject(error)
}
});
});
};
//实际的异步方法还是原先那个,只不过Promise对象把这个异步过程分为了resolve和reject 2种状态。

相关文章:

  • 2022-12-23
  • 2022-02-13
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2022-01-03
  • 2022-03-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-01-04
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案