异步的解决方案-ES6的Promise
程序员文章站
2023-12-22 13:45:10
...
异步的解决方案-ES6的Promise
menuType().then(function(menuArr){
videoAll();
});
function countnum(mtype){
var count = new Promise(function(resolve,reject){
$.ajax({
url:'',
// dataType:'jsonp',
processData: false,
async:true,
type:'get',
success:function(data){
resolve(data);
},
error:function(XMLHttpRequest, textStatus, errorThrown) {
reject("faild");
}
});
});
return count;
}