var cc=false;
var bb=false;
$('#start').click(function(){
if(bb==true){
//bb等于true执行后台方法
query();
}
for(var i=0;i<10;i++){
allCheck(i);//在这里就循环完了怎么能使他同步?
}
});
function allCheck(i){
if(cc==false){
$.ajax({
async:false,
url : "https://www.1688.com/index.jsonp?page="+i+"",
type : "get",
dataType : "jsonp",
success : function (f) {
f.rgv587_flag != undefined ? showLayerTips(f.url): showBestCategory(i,f);//
}
//爬网页结束
});
}
}
//获取成功执行
function showBestCategory(i,f){
if(f!=null){
bb=true;
}else{
bb=false;
}
}
//弹出错误页面
function showLayerTips(url){
cc =true;
}
//执行后台方法
function query(){
publicload(getRootPath() + "/searchRank","pageList","");
}