search

Home  >  Q&A  >  body text

Don't want to close modal after submitting data in modal PHP

<p>I want to keep the same pattern after submitting this form</p> <p><code>generateBarcode.php</code>:</p> <pre class="brush:php;toolbar:false;"><form action="savegenarateBarcode.php?id=<?php echo $d1; ?>" method="post"> ;</pre> <p><code>savegenerateBarcode.php</code>:</p> <pre class="brush:php;toolbar:false;"><?php try { session_start(); include('../connect.php'); $d1 = $_GET['id']; $b = $_POST['serialnumber']; $sqlm = "select *from product_item where serialnumber='".$b."'"; $query = $db->prepare($sqlm); $user_array = $query ->execute(); }</pre> <p>How can I keep <code>generateBarcode.php(modal)</code> unchanged after submitting this form? </p>
P粉940538947P粉940538947457 days ago521

reply all(1)I'll reply

  • 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;
        });

    reply
    0
  • Cancelreply