标签:eject nbsp fun resolve class false turn style ISE
const checkUrl = function (url) { const promise = new Promise(function (resolve, reject) { if (!url) reject(‘无效路径‘); $.ajax({ url: url, type: ‘GET‘, dataType: "jsonp", //跨域采用jsonp方式 complete: (response)=> { if(response.status==200) resolve(true) else resolve(false) } }); }); return promise; }
checkUrl(url).then(res=>{
if(res){
alert(‘有效‘)
}else {
alert(‘无效‘)
}
});
标签:eject nbsp fun resolve class false turn style ISE
原文地址:https://www.cnblogs.com/web-fusheng/p/11812869.html