jQuery Mobile sahifasi tuzish sahifada qayta ochilmaydi

Mana mening stsenariyim: Men ichki tizim foydalanuvchi interfeysi uchun veb-ilovani qurmoqdaman. Men jQuery Mobile-dan foydalanishni rejalashtirmoqdaman, chunki u juda zerikarli. Har bir fayl namunasi davom etadigan bitta sahifa mavjud. Quyida ko'rsatilgan processinputs.html nomli fayl bor. Buning barchasi sizga input.html-ga sizning kanal raqamini tanlagan holda so'rov parametr bilan o'tish.

Muammo: Birinchi marta processinputs.html dan inputs.html? I = 3 dan har bir narsa ajoyib ishlaydi. Sarlavha va havola o'zgartiriladi. Processinputs.html-ga qaytib kirsam va yana uchinchi kirish havolasini bossak, voqea ishlamaydi va shuning uchun mening sarlavha yangilamaydi.

Men buni AJAX bilan keshlangan sahifani yuklash bilan bog'liq deb hisoblayman va shu bilan "pagecreate" hodisasini tetiklamayapman. Men ham "pageinit" va "pagebeforecreate" ni sinab ko'rdim. Project.js faylimda domCache va ajaxni o'chirib qo'yishdi, lekin u ishlamayapti. Processinputs.html-ga kirish 1 ga "rel = external" kodini qattiq kodladim. Bu har safar ishlaydi, lekin jQMobile juda ajabli, chunki ajaxlarni yuklash va ko'rsatuvlar. Agar men sizni keshlash jarayonini qanday qilib boshlashimga yordam berishimga yordam beradigan bo'lsam, men juda ko'p majburiyatlarga ega bo'lardim.

$(document).bind("mobileinit", function(){
$.mobile.ajaxLinksEnabled=false;
$.mobile.ajaxFormsEnabled=false;
$.mobile.ajaxEnabled=false;
$.mobile.page.prototype.options.domCache = false;

});

Hozir va'da qilingan processinputs.html uchun

<html>
<head>
    <link rel="stylesheet" href="css/jquery.mobile-1.0rc2.css" />
    <link rel="stylesheet" href="css/styles.css" />
    <script src="js/jquery.min.js"></script>
    <script src="js/project.js"></script>
    <script src="js/jquery.mobile-1.0rc2.js"></script>

    <meta name="viewport" content="width=default-width, initial-scale=1" />
</head>
<body>
    <div data-role="page" data-add-back-btn="true" data-cache="never">
        <div data-role="header" data-position="inline">
            <div class="topTitle">Process Inputs</div>
            Home
        </div><!--  header -->

        <div data-role="content">   
            <div class="instructionText">Select an input</div>

            <div>  <!-- Container around button options -->
                Input 1
                Input 2
                Input 3
                Input 4
                Input 5
                Input 6
                Input 7
                Input 8
            </div>
        </div><!-- /content -->

        <div data-role="footer">
            <div class="footerText">A Senior Design G13 Project
        </div><!-- /footer -->

    </div><!-- /page -->
</body>

input.html takes the query param and uses it to modify the header of input.html as well as the query param for the three links on the page. The code is shown below:

    <link rel="stylesheet" href="css/jquery.mobile-1.0rc2.css" />
    <link rel="stylesheet" href="css/styles.css" />
    <script src="js/jquery.min.js"></script>
    <script src="js/project.js"></script>

    <script type="text/javascript">
        $('.inputPage').live('pagecreate', function (event, ui) {
            var inum = $.urlParam('i');
            $('#inputTitle').text('Process Input ' + inum);
            $('#eqLink').attr('href','eq.html?i=' + inum)
        });

       //$('div').live('pagehide', function(event, ui){
       //      var page = jQuery(event.target);
       //      if(page.attr('data-cache') == 'never'){
       //        page.remove();
       //      };   
       //    });
    </script>
    <script src="js/jquery.mobile-1.0rc2.js"></script>
</head>
<body>
    <div data-role="page" data-add-back-btn="true" data-cache="never" class="inputPage">
        <div data-role="header" data-position="inline">
            <div class="topTitle" id="inputTitle"></div>
            Home
        </div><!--  header -->

        <div data-role="content">   
            <div class="instructionText">Select one.</div>

            <div>  <!-- Container around button options -->
                Equalization
                Compression
                Limiting
            </div>
        </div><!-- /content -->

        <div data-role="footer">
            <div class="footerText">A Senior Design G13 Project
        </div><!-- /footer -->

    </div><!-- /page -->
</body>
0
Har bir sahifa uchun JavaScript-ni ildiz sahifasida bo'lishi kerak (index.html yoki birinchi marta yuklagan sahifangiz)
qo'shib qo'ydi muallif Phill Pafford, manba
javob sifatida e'lon qilindi
qo'shib qo'ydi muallif Phill Pafford, manba
Ajoyib! Buni qildi. Yaxshilik ... oddiy narsalar.
qo'shib qo'ydi muallif Matt Webb, manba

1 javoblar

Har bir sahifa uchun JavaScript-ni ildiz sahifasida bo'lishi kerak (index.html yoki birinchi marta yuklagan sahifangiz)

1
qo'shib qo'ydi
Agar foydalanuvchi to'g'ridan-to'g'ri /input.html?i=2 ga kirsa nima bo'ladi?
qo'shib qo'ydi muallif cherouvim, manba