ホームページ  >  に質問  >  本文

モーダル PHP でデータを送信した後にモーダルを閉じたくない

<p>このフォームを送信した後も同じパターンを維持したい</p> <p><code>generateBarcode.php</code>:</p> <pre class="brush:php;toolbar:false;"><form action="savegenerateBarcode.php?id=<?php echo $d1; ?>" method="post"> ;</pre> <p><code>savegenerateBarcode.php</code>:</p> <pre class="brush:php;toolbar:false;"><?php 試す { セッション開始(); include('../connect.php'); $d1 = $_GET['id']; $b = $_POST['シリアル番号']; $sqlm = "select *from product_item whereserialnumber='"".$b."""; $query = $db->prepare($sqlm); $user_array = $query ->execute(); }</pre> <p>このフォームを送信した後、<code>generateBarcode.php(modal)</code> を変更しないようにするにはどうすればよいですか? </p>
P粉940538947P粉940538947383日前447

全員に返信(1)返信します

  • P粉222320176

    P粉2223201762023-09-05 11:57:39

    I think you should use ajax because the form submit method reload the page.

    var id = '<?php echo $d1; ?>';
    $("#submit").click(function(){
            $.ajax({
                type: 'GET',
                url: "savegenarateBarcode.php",
                data:`id=${id}`
                success:function(data){
                 alert(data);
                }
            });
        return false;
        });

    返事
    0
  • キャンセル返事