问题描述:get请求不执行,给确定的参数值get请求可以执行并成功拿到结果集。
代码如下:
document.addEventListener("schoolInfo",function(event){
var city=event.detail.city;
var qualification=event.detail.phase;
if(!city | !qualification){
return;
};
getJson(city,qualification);
// getJson('浙江省杭州市','高职生');
});
function getJson(city,qualification){
mui.get("正确的url", {
schcity:city,
phase:qualification
}, function(result) {
$(result.data).each(function() {
$("#rank").append(
'<li class="mui-table-view-cell mui-media"> ' +
'<a class="mui-navigate-right">' +
'<img class="mui-media-object mui-pull-left" src="URL/'+this.SCHPICTURE+'">'+
'<div class="mui-media-body">' + this.SCHNAME +
'<p class="mui-ellipsis">'+'</p></div>' +
'<p class="price">'+this.SCHTIME+'</p>'+
'<p class="price-1">' + this.SCHLOOK + '</p>' +
' </a>' +
'</li>');
});
}, "json");
}
if(!city | !qualification)或写错了?
这样写没有错
参数问题,之前参数做过拼接,用split重新进去