jQuery mobile:等待$ .getJSON完成

碧金

我想用$.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。

阿伦·P·约翰尼(Arun P Johny)

$.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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章