$("#testButton").click(function () {
getCorpRatio2();
// getCorpInfo();
});
$(function () {
//地图
initChartMaplegaPersonMonitor();
//获得法人数,总访问量,月访问量
getCorpInfo();
//获取增长
getCorpRise();
//获取类型占比
getCorpRatio2();
});
//法人类型占比
function getCorpRatio2() {
var city_name=$("#area").val();
$.ajax({
async:false,
type: "POST",
url: getRootPath() + "/bsvinterface/faren/getCorpRatio",
dataType: "json",
data:{
"city_name":city_name
},
success: function (data) {
if(data.code=="1"){
initChartPieLegaPersonType(data.data);
}else{
layer.msg(data.data.msg,function(){},2000);
}
},
error:function(){
layer.msg('网络异常',function(){},2000);
}
})
};
/*
$(document).ready(function () {
// mock模拟数据
const url = '';
Mock.mock(url, {
"dataIntegration|10": [{
"name": "@cword(10, 15)",
"value|1-100": 100,
}],
"legaPersonType|4": [{
"name": "@cword(2, 4)",
"value|1-50": 100,
}],
"legaPersonGrow|3": [{
"name": "@cword(7,8)",
"value|1-50": 100,
}],
});
$.ajax({
url: url,
dataType: "json"
}).done(function (data, status, xhr) {
//地图
// initChartMaplegaPersonMonitor();
//法人类型占比
// initChartPieLegaPersonType(data['legaPersonType']);
//法人增长占比
// initChartBarLegaPersonGrow(data['legaPersonGrow']);
//创建数据整合
creatTableDataIntegration(data['dataIntegration'])
});
});*/
如上面代码,当mock模拟数据代码打开后,就会出现ajax不请求后端的情况