0

要するに、jquery mobile に問題があります。jquery からのソースを無効にすると、スクリプトが実行されます。しかし、jquery のソースをアクティブにすると、私の php スクリプトは機能しませんでした。

これは私のスクリプトです

        <html> 
            <head> 
            <title>Security</title> 
            <meta name="viewport" content="width=device-width, initial-scale=1"> 
            <!--script for jquery source-->
            <link rel="stylesheet" href="jqm2/jquery.mobile-1.3.1.min.css" />
            <script src="jqm2/jquery.js"></script>
            <script src="jqm2/jquery.mobile-1.3.1.min.js"></script>
             <!--script for jquery source-->

            </head> 
        <body> 
        <div data-role="page" id="BahanBaku" class="type-interior" data-theme="c">

        <div data-role="header">
            <h1>Bahan Baku</h1>
        </div><!-- /header -->

    <div data-role="content">   

         <form method="post" action="BahanBaku.php">
           <!--this select button-->
         <select name="BARANG" data-native-menu="false" onchange="this.form.submit()">
            <option value="">Pilih Nama Barang</option>
            <option value="A">A</option>
            <option value="B">B</option>


         </select>
            <!--this select button-->
         </form>

         <?php
         //this script for get data from mysql based the select button
            if(isset($_POST[BARANG])){

                $barang = $_POST[BARANG];

                //print_r($_POST);

                $sql2 = "SELECT *  FROM tb_spekbaku WHERE namaBarang = '$barang' ";

                $hasil2 = mysql_query($sql2) or die ('Error = '. mysql_error());

                $data2 = mysql_fetch_array($hasil2);



            }
            ?>

       <table data-role="table" id="table-column-toggle" data-mode="columntoggle" class="ui-responsive table-stroke">
         <thead>
           <tr>
             <th>Jenis Spec</th>
             <th>Spec</th>

           </tr>
         </thead>
         <tbody>
           <tr>
             <th>Lain lain</th>
             <td><?php echo $data2[lain];?></td><!--this is the line when jquery inactive the result showed, but if jquery active the result not show again-->

           </tr>
          </tbody>
          </table>    

        </div><!--end off  content-->
        <div data-role="footer">
            <h4>Bla bla </h4>
        </div><!-- /footer -->
    </div><!--end of page-->    
</body>
</html>

誰でもこれを修正するのを手伝ってもらえますか? 私はあなたの答えをとても感謝していますありがとう

4

1 に答える 1

0

デフォルトでは、フォーム送信は jQM の Ajax で自動的に処理されます。

この動作を防ぐには、data-ajax="false"属性をフォーム要素に追加します。

<form method="post" action="BahanBaku.php" data-ajax="false">
于 2013-05-22T04:24:22.810 に答える