jquery.tmpl()页面刷新后(jquery-mobile)无法渲染

时间:2014-06-10 23:12:33

标签: jquery jquery-mobile cordova jquery-templates

我正在使用phonegap和jquery-mobile 1.4。刷新页面后

$.mobile.changePage(window.location.href, {
            allowSamePageTransition: true,
            transition: 'none',
            reloadPage: true
        });
        }, 1500);

jquery.tmpl()不再将数据附加到div,任何想法?

//template
$("#task_pics").tmpl(info).appendTo("#owl-demo");

//更新整个代码:

gettasks: function(info) {

    //LOADING
    App.utilities.Loading();

    $.ajax({        
        type: "POST",       
        url: 'xxx',     
        data: "xxx",
        success: function(data) {

            alert(data);

            var info = JSON.parse(data);        
            $("#query_image").tmpl(info).appendTo(".refpic_");

            //SetBatchID
            var id = info.batchId;
            token.set_batchID(id);

            //template
            $("#task_pics").tmpl(info).appendTo("#owl-demo");

            //stop the ajax loder
            $.unblockUI();

            //OWL CAROUSEL
            $("#owl-demo").owlCarousel({
                    mouseDrag : false,
                    touchDrag : false,
                    autoPlay : true, 
                    items: 2, 
                    itemsMobile: true
            });

        }, error: function(jqXHR, textStatus, errorThrown) {
            if (jqXHR.status == 404) {
                navigator.notification.alert("Anmeldung fehlgeschlagen.", App.utilities.devNULL, "Hinweis");
                $.unblockUI();
                //if token is not valid anymore -> logout (TODO)
                $.mobile.navigate('index.html');


            } else if (jqXHR.status == 500) {
                navigator.notification.alert("Anmeldung fehlgeschlagen.", App.utilities.devNULL, "Hinweis");
                $.unblockUI();
                //if token is not valid anymore -> logout (TODO)
                $.mobile.navigate('index.html');

            }
        }
    });

此外,如果我将代码添加到:

$(document).on("pageinit", "#microtasks", function (event) {
});

tmpl()没有附加数据 - 刷新后我再次调用该函数,数据被加载但渲染没有发生

最好的

中号

0 个答案:

没有答案
相关问题