JQM多页面和php需要

I have a php-script controlling some JQM-pages. The JQM pages are activated using php require. It works fine for all single-page JQM pages and almost for the multi-page JQM page. The only problem is that the link (anchor) button on the multi-page seems to be dead (href="#page2" for example).

The dead link button works if I reload the multi-page or if I start the multi-page by hand in the browser.

Do you have a solution to this problem (except adding a reload or turning the multi-page into single pages)?

This does not work (all files on server):

index.php:

<?php
session_start();
$action = isset( $_GET['action'] ) ? $_GET['action'] : "";
if ( !$action ) $action = isset( $_POST['action'] ) ? $_POST['action'] : "";
if ($action == 'multi')
   require('multi.php');
else
   require('single.php');
?>

single.php:

    <?php ?>
<!doctype html>
<html>
<head>
  <title>SINGLE</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
  <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
  <script type="text/javascript" src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <link rel="apple-touch-icon" href="images/app-icon.png">

</head>
<body>

    <div data-role="page" id="single">
        <div data-role="header" data-theme="a">
            <h2>SINGLE 1(1)</h2>    
        </div>
        <div data-role="content">
            <p>This is page single.</p>
            <form action="index.php" method="post" >
                <fieldset data-role="controlgroup">
                     <input type="submit" name="action" id="multi" value="multi">
                </fieldset>
            </form>
        </div>
    </div>
  </body>
</html>

multi.php:

    <?php ?>
<!doctype html>
<html>
<head>
  <title>MULTI</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
  <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
  <script type="text/javascript" src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <link rel="apple-touch-icon" href="images/app-icon.png">

</head>
<body>
    <div data-role="page" id="page1">
        <div data-role="header" data-theme="a">
            <h2>MULTI 1(2)</h2> 
        </div>
        <div data-role="content">
            <p>This is page 1.</p>
        </div>
        <div data-role="footer" data-position="fixed" data-theme="a" data-id="nav">
            <div data-role="navbar">
                <ul>
                    <li><a class="ui-btn" data-transition="slide" data-icon="arrow-r" data-iconpos= "top" href="#page2">Next</a></li>
                </ul>
            </div>
        </div>
    </div>
    <div data-role="page" id="page2">
        <div data-role="header" data-theme="a">
            <h2>MULTI 2(2)</h2> 
        </div>
        <div data-role="content">
            <p>This is page 2.</p>
        </div>
    </div>
  </body>
</html>

Start index.php in the browser, tap multi button, and now the next button is not working...

php
drux41001
drux41001 不,但那是解决方案。谢谢!
接近 5 年之前 回复
dongliqian6245
dongliqian6245 在Single中,你试过<formaction=“index.php”method=“post”data-ajax=“false”>?
接近 5 年之前 回复
duanhe4155
duanhe4155 添加了一个小的不工作的例子(见上文)
接近 5 年之前 回复
duanchouyi6730
duanchouyi6730 使用一个非常小的示例'require'+多页工作。所以我必须添加更多代码,直到它不工作为止......
接近 5 年之前 回复
duannaiying9662
duannaiying9662 您当前的项目可能包含大量代码,但如果有任何方法可以创建MCVE,那么我们将永远感激!
接近 5 年之前 回复
duandao7704
duandao7704 有很多代码,所以我必须带走很多东西才能显示出来。我试图更改按钮以运行JQMAPI“更改”但具有相同的结果(如我所料)。我认为一般的问题应该是:JQM能否真正处理这个问题(需要,多页,href=“#page1”)还是我必须去单页?
接近 5 年之前 回复
donglian6625
donglian6625 你有代码吗?你试图解决这个问题是什么?
接近 5 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐