【问题标题】:load external file into page id in jquery mobile将外部文件加载到jquery mobile中的页面ID中
【发布时间】:2017-12-03 20:18:02
【问题描述】:

我有一个外部文件 profile.php,我想在单击链接后将其加载到子页面 id profile 中。我尝试了下面的代码,但在单击事件后我没有看到任何显示,触发点击事件是因为我已经对其进行了测试alert,控制台中没有错误我认为我遗漏了一些东西,请帮忙。谢谢

  $(document).on("click", "#profilel",function(){
$( ":mobile-pagecontainer" ).pagecontainer( "load", "profile.php" )
 });

【问题讨论】:

    标签: javascript php jquery jquery-mobile


    【解决方案1】:

    试试这个

    $(document).on("click", "#profile",function(){
    $( ":mobile-pagecontainer" ).pagecontainer( "load", "profile.php" )
     });
    

    $("#profilel").click(function(){
      $.get("profile.php")
         .done(function(data){
          $( ":mobile-pagecontainer" ).html(data);
        });
    });
    

    【讨论】:

    • 我只是在我的第一个答案中将 id "#profilel 更改为 #profile",以防您的 id 错误。
    猜你喜欢
    • 1970-01-01
    • 2013-07-09
    • 2012-07-31
    • 1970-01-01
    • 2012-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多