Echarts实战案例代码(22):jquery使用ajax属性beforeSend实现预加载loading效果代替showLoading的解决方案
在Echarts的图表加载过程中,由于使用函数调用,而不是在ajax内部直接使用Echarts,导致showLoading无法正常使用。现在通过jquery自带参数进行loading效果。

beforeSend: function () {
$("#wtbody").html("<div style='width: 100%;margin:0 auto;height: 250px;line-height: 250px;'><img src='static/lockdatav/images/loading.gif'></div>");
},
success: function (res) {
$("#city").html('');//返回值后,一定要清除
}
Done!
浙公网安备 33010602011771号