我想用$.getJSON
调用填充一个表:
$.getJSON("localhost/url",
function (data) {
$.each(data.reporting_list.reporting, function (i, item) {
rows = '<tr><td>' + item.data1 + '</td><td>' + item.data2 + '</td></tr>'
});
$('#aaa').append(rows);
});
填充后,我想触发一些页面更改:
$.mobile.changePage("#homePage");
但是页面在$.getJSON
完成之前会更改。
我只想在$.getJSON
完成后才更改页面,而是显示ajaxloader。
做
$.getJSON("localhost/url", function (data) {
$.each(data.reporting_list.reporting, function (i, item) {
rows = '<tr><td>' + item.data1 + '</td><td>' + item.data2 + '</td></tr>'
});
$('#aaa').append(rows);
//move to the page in the callback itself
$.mobile.changePage("#homePage");
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句