$.mobile.changePage instead of $.ajax

天大地大妈咪最大 提交于 2019-12-25 02:09:09

问题


I'm new in jquerymobile, so, how can i migrate from a simple $.ajax() call to a $.mobile.changePage ?

my normal ajax its something like this (from a click event):

$.ajax({
    url: 'mobile/' + content,
    type: 'GET',
    success: function (data) {
        $(".content").html(data);
    },
    error: function (XMLHTTPRequest) {
    }
});

basicly, all the ajax call (some simple html) will be droped inside the $(".content");

so, how can i do this, using changePage?

i try this, but he only fade the page and nothing happen, i think my target is missing, dont know.

$(".bottom-but-list li").on("click", function () {
    var content = $(this).attr("class").split(" ")[0]; // get the content to url

    $.mobile.changePage("mobile/" + content, {
        transition: "flip",
        reverse: true,
        changeHash: false,
        pageContainer: $("#page")
    });
});

html:

<div id="main-content" class="content">
     <!-- ajax should load here -->
 </div>

what i'm missing ?

来源:https://stackoverflow.com/questions/13404462/mobile-changepage-instead-of-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!