How to reset/clean values from a query inside “Bootstrap 4” modal?Bind a function to Twitter Bootstrap Modal CloseDisallow Twitter Bootstrap modal window from closingHow to hide Bootstrap modal with javascript?Passing data to a bootstrap modalBootstrap modal appearing under backgroundHow to open a Bootstrap modal window using jQuery?How do I return the response from an asynchronous call?Prevent Bootstrap Modal from disappearing when clicking outside or pressing escape?Close Bootstrap ModalUpdating database from bootstrap modal form

Why do Windows registry hives appear empty?

If a person had control of every single cell of their body, would they be able to transform into another creature?

I unknowingly submitted plagarised work

Website returning plaintext password

Construct a word ladder

Ticket to ride, 1910: What are the big cities

How to respond to an upset student?

Image processing: Removal of two spots in fundus images

Why did David Cameron offer a referendum on the European Union?

Should breaking down something like a door be adjudicated as an attempt to beat its AC and HP, or as an ability check against a set DC?

Find limit in use of integrals

Were pens caps holes designed to prevent death by suffocation if swallowed?

What are these arcade games in Ghostbusters 1984?

At what point in European history could a government build a printing press given a basic description?

Conservation of energy when slowing an object down

What does this symbol on the box of power supply mean?

How should I introduce map drawing to my players?

Did people go back to where they were?

How to use " shadow " in pstricks?

Count Even Digits In Number

Use backslash or single-quotes for field separation

Why is this Simple Puzzle impossible to solve?

Where have Brexit voters gone?

Make 24 using exactly three 3s



How to reset/clean values from a query inside “Bootstrap 4” modal?


Bind a function to Twitter Bootstrap Modal CloseDisallow Twitter Bootstrap modal window from closingHow to hide Bootstrap modal with javascript?Passing data to a bootstrap modalBootstrap modal appearing under backgroundHow to open a Bootstrap modal window using jQuery?How do I return the response from an asynchronous call?Prevent Bootstrap Modal from disappearing when clicking outside or pressing escape?Close Bootstrap ModalUpdating database from bootstrap modal form






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a featured items box that is loop using an "id" to each "Details" button.
My problem is the "Bootstrap 4 modal" uses the values from the first "Details" button that was clicked even if I click on other featured item's "Details" Button



How to reset or clean the values on my "Bootstrap 4 modal not 3 ? because it keeps using the values from the very firts id that was used even if i clicked on other buttons



jQuery Ajax



 var data = "id" : id; //Json string 
jQuery.ajax(
url: "/myecommerse/includes/wala2.php",
type: "POST",
data: data,
success : function(data)
jQuery('body').append(data);
jQuery('#details-modal').modal('toggle');
$('body').on('hidden.bs.modal', '#details-modal', function ()
$(this).removeData('bs.modal');
);
,
error : function()
alert('something went wrong');


);

}


Modal




<?php




include '../core/init.php';
$id = $_POST['id'];

$sql = "SELECT * FROM products WHERE id = '$id'";
$result = $db->query($sql);
$product = mysqli_fetch_assoc($result);


?>



<!-- Modal -->
<?php
ob_start();

?>

<div class="modal fade details-modal" id="details-modal" tabindex="-1" role="dialog" aria-labelledby="details-modal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal" aria-label="close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title text-center"><?php echo $product['title']; ?></h4>
<h4 class="modal-title text-center"><?php echo $_POST['id']; ?></h4>
</div>
<div class="modal-body">
<div class="container-fluid">

<div class="row">
<div class="col-sm-6">
<div class="center-block">
<img src="<?php echo $product['img']; ?>" alt="<?php echo $product['title']; ?>" class="details img-responsive"/>
</div>
</div>
<div class="col-sm-6">
<h4>Details</h4>
<p><?php echo $product['description']; ?></p>
<hr>
<p>Price: <?php echo $product['price']; ?></p>
<form action="add_cart.php" method="post">
<div class="form-group">
<div class="col-xs-3">
<label for="quantity">Quantity</label>
<input type="text" class="form-control" id="quantity" name="quantity">
</div>
<p>Available:3</p>
</div>
<div class="form-group">
<label for="size">Size</label>
<select name="size" id="size" class="form-group">
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
<option value="extralarge">Extra large</option>
</select>
</div>
</form>

</div>
</div>
</div>
</div>

<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal">Close</button>
<button class="btn btn-warning" type="submit"><span class="glyphicon glyphicon-shooping-cart"></span>Add to cart</button>
</div>
</div>
</div>

</div>

<script>
function closeModal()

jQuery.('#details-modal').modal('hide');

$('body').on('hidden.bs.modal', '#details-modal', function ()
$(this).removeData('bs.modal');
);

setTimeout(function()
jQuery.('#details-modal').remove();
,500);


</script>

<?php
echo ob_get_clean();
?>


Thanks for the answer in advance..










share|improve this question




























    0















    I have a featured items box that is loop using an "id" to each "Details" button.
    My problem is the "Bootstrap 4 modal" uses the values from the first "Details" button that was clicked even if I click on other featured item's "Details" Button



    How to reset or clean the values on my "Bootstrap 4 modal not 3 ? because it keeps using the values from the very firts id that was used even if i clicked on other buttons



    jQuery Ajax



     var data = "id" : id; //Json string 
    jQuery.ajax(
    url: "/myecommerse/includes/wala2.php",
    type: "POST",
    data: data,
    success : function(data)
    jQuery('body').append(data);
    jQuery('#details-modal').modal('toggle');
    $('body').on('hidden.bs.modal', '#details-modal', function ()
    $(this).removeData('bs.modal');
    );
    ,
    error : function()
    alert('something went wrong');


    );

    }


    Modal




    <?php




    include '../core/init.php';
    $id = $_POST['id'];

    $sql = "SELECT * FROM products WHERE id = '$id'";
    $result = $db->query($sql);
    $product = mysqli_fetch_assoc($result);


    ?>



    <!-- Modal -->
    <?php
    ob_start();

    ?>

    <div class="modal fade details-modal" id="details-modal" tabindex="-1" role="dialog" aria-labelledby="details-modal" aria-hidden="true">
    <div class="modal-dialog modal-lg">
    <div class="modal-content">
    <div class="modal-header">
    <button class="close" type="button" data-dismiss="modal" aria-label="close">
    <span aria-hidden="true">&times;</span>
    </button>
    <h4 class="modal-title text-center"><?php echo $product['title']; ?></h4>
    <h4 class="modal-title text-center"><?php echo $_POST['id']; ?></h4>
    </div>
    <div class="modal-body">
    <div class="container-fluid">

    <div class="row">
    <div class="col-sm-6">
    <div class="center-block">
    <img src="<?php echo $product['img']; ?>" alt="<?php echo $product['title']; ?>" class="details img-responsive"/>
    </div>
    </div>
    <div class="col-sm-6">
    <h4>Details</h4>
    <p><?php echo $product['description']; ?></p>
    <hr>
    <p>Price: <?php echo $product['price']; ?></p>
    <form action="add_cart.php" method="post">
    <div class="form-group">
    <div class="col-xs-3">
    <label for="quantity">Quantity</label>
    <input type="text" class="form-control" id="quantity" name="quantity">
    </div>
    <p>Available:3</p>
    </div>
    <div class="form-group">
    <label for="size">Size</label>
    <select name="size" id="size" class="form-group">
    <option value="small">Small</option>
    <option value="medium">Medium</option>
    <option value="large">Large</option>
    <option value="extralarge">Extra large</option>
    </select>
    </div>
    </form>

    </div>
    </div>
    </div>
    </div>

    <div class="modal-footer">
    <button class="btn btn-default" data-dismiss="modal">Close</button>
    <button class="btn btn-warning" type="submit"><span class="glyphicon glyphicon-shooping-cart"></span>Add to cart</button>
    </div>
    </div>
    </div>

    </div>

    <script>
    function closeModal()

    jQuery.('#details-modal').modal('hide');

    $('body').on('hidden.bs.modal', '#details-modal', function ()
    $(this).removeData('bs.modal');
    );

    setTimeout(function()
    jQuery.('#details-modal').remove();
    ,500);


    </script>

    <?php
    echo ob_get_clean();
    ?>


    Thanks for the answer in advance..










    share|improve this question
























      0












      0








      0








      I have a featured items box that is loop using an "id" to each "Details" button.
      My problem is the "Bootstrap 4 modal" uses the values from the first "Details" button that was clicked even if I click on other featured item's "Details" Button



      How to reset or clean the values on my "Bootstrap 4 modal not 3 ? because it keeps using the values from the very firts id that was used even if i clicked on other buttons



      jQuery Ajax



       var data = "id" : id; //Json string 
      jQuery.ajax(
      url: "/myecommerse/includes/wala2.php",
      type: "POST",
      data: data,
      success : function(data)
      jQuery('body').append(data);
      jQuery('#details-modal').modal('toggle');
      $('body').on('hidden.bs.modal', '#details-modal', function ()
      $(this).removeData('bs.modal');
      );
      ,
      error : function()
      alert('something went wrong');


      );

      }


      Modal




      <?php




      include '../core/init.php';
      $id = $_POST['id'];

      $sql = "SELECT * FROM products WHERE id = '$id'";
      $result = $db->query($sql);
      $product = mysqli_fetch_assoc($result);


      ?>



      <!-- Modal -->
      <?php
      ob_start();

      ?>

      <div class="modal fade details-modal" id="details-modal" tabindex="-1" role="dialog" aria-labelledby="details-modal" aria-hidden="true">
      <div class="modal-dialog modal-lg">
      <div class="modal-content">
      <div class="modal-header">
      <button class="close" type="button" data-dismiss="modal" aria-label="close">
      <span aria-hidden="true">&times;</span>
      </button>
      <h4 class="modal-title text-center"><?php echo $product['title']; ?></h4>
      <h4 class="modal-title text-center"><?php echo $_POST['id']; ?></h4>
      </div>
      <div class="modal-body">
      <div class="container-fluid">

      <div class="row">
      <div class="col-sm-6">
      <div class="center-block">
      <img src="<?php echo $product['img']; ?>" alt="<?php echo $product['title']; ?>" class="details img-responsive"/>
      </div>
      </div>
      <div class="col-sm-6">
      <h4>Details</h4>
      <p><?php echo $product['description']; ?></p>
      <hr>
      <p>Price: <?php echo $product['price']; ?></p>
      <form action="add_cart.php" method="post">
      <div class="form-group">
      <div class="col-xs-3">
      <label for="quantity">Quantity</label>
      <input type="text" class="form-control" id="quantity" name="quantity">
      </div>
      <p>Available:3</p>
      </div>
      <div class="form-group">
      <label for="size">Size</label>
      <select name="size" id="size" class="form-group">
      <option value="small">Small</option>
      <option value="medium">Medium</option>
      <option value="large">Large</option>
      <option value="extralarge">Extra large</option>
      </select>
      </div>
      </form>

      </div>
      </div>
      </div>
      </div>

      <div class="modal-footer">
      <button class="btn btn-default" data-dismiss="modal">Close</button>
      <button class="btn btn-warning" type="submit"><span class="glyphicon glyphicon-shooping-cart"></span>Add to cart</button>
      </div>
      </div>
      </div>

      </div>

      <script>
      function closeModal()

      jQuery.('#details-modal').modal('hide');

      $('body').on('hidden.bs.modal', '#details-modal', function ()
      $(this).removeData('bs.modal');
      );

      setTimeout(function()
      jQuery.('#details-modal').remove();
      ,500);


      </script>

      <?php
      echo ob_get_clean();
      ?>


      Thanks for the answer in advance..










      share|improve this question














      I have a featured items box that is loop using an "id" to each "Details" button.
      My problem is the "Bootstrap 4 modal" uses the values from the first "Details" button that was clicked even if I click on other featured item's "Details" Button



      How to reset or clean the values on my "Bootstrap 4 modal not 3 ? because it keeps using the values from the very firts id that was used even if i clicked on other buttons



      jQuery Ajax



       var data = "id" : id; //Json string 
      jQuery.ajax(
      url: "/myecommerse/includes/wala2.php",
      type: "POST",
      data: data,
      success : function(data)
      jQuery('body').append(data);
      jQuery('#details-modal').modal('toggle');
      $('body').on('hidden.bs.modal', '#details-modal', function ()
      $(this).removeData('bs.modal');
      );
      ,
      error : function()
      alert('something went wrong');


      );

      }


      Modal




      <?php




      include '../core/init.php';
      $id = $_POST['id'];

      $sql = "SELECT * FROM products WHERE id = '$id'";
      $result = $db->query($sql);
      $product = mysqli_fetch_assoc($result);


      ?>



      <!-- Modal -->
      <?php
      ob_start();

      ?>

      <div class="modal fade details-modal" id="details-modal" tabindex="-1" role="dialog" aria-labelledby="details-modal" aria-hidden="true">
      <div class="modal-dialog modal-lg">
      <div class="modal-content">
      <div class="modal-header">
      <button class="close" type="button" data-dismiss="modal" aria-label="close">
      <span aria-hidden="true">&times;</span>
      </button>
      <h4 class="modal-title text-center"><?php echo $product['title']; ?></h4>
      <h4 class="modal-title text-center"><?php echo $_POST['id']; ?></h4>
      </div>
      <div class="modal-body">
      <div class="container-fluid">

      <div class="row">
      <div class="col-sm-6">
      <div class="center-block">
      <img src="<?php echo $product['img']; ?>" alt="<?php echo $product['title']; ?>" class="details img-responsive"/>
      </div>
      </div>
      <div class="col-sm-6">
      <h4>Details</h4>
      <p><?php echo $product['description']; ?></p>
      <hr>
      <p>Price: <?php echo $product['price']; ?></p>
      <form action="add_cart.php" method="post">
      <div class="form-group">
      <div class="col-xs-3">
      <label for="quantity">Quantity</label>
      <input type="text" class="form-control" id="quantity" name="quantity">
      </div>
      <p>Available:3</p>
      </div>
      <div class="form-group">
      <label for="size">Size</label>
      <select name="size" id="size" class="form-group">
      <option value="small">Small</option>
      <option value="medium">Medium</option>
      <option value="large">Large</option>
      <option value="extralarge">Extra large</option>
      </select>
      </div>
      </form>

      </div>
      </div>
      </div>
      </div>

      <div class="modal-footer">
      <button class="btn btn-default" data-dismiss="modal">Close</button>
      <button class="btn btn-warning" type="submit"><span class="glyphicon glyphicon-shooping-cart"></span>Add to cart</button>
      </div>
      </div>
      </div>

      </div>

      <script>
      function closeModal()

      jQuery.('#details-modal').modal('hide');

      $('body').on('hidden.bs.modal', '#details-modal', function ()
      $(this).removeData('bs.modal');
      );

      setTimeout(function()
      jQuery.('#details-modal').remove();
      ,500);


      </script>

      <?php
      echo ob_get_clean();
      ?>


      Thanks for the answer in advance..







      jquery ajax bootstrap-4 modal-dialog reset






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 5:44









      Ian ShinIan Shin

      12




      12






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321061%2fhow-to-reset-clean-values-from-a-query-inside-bootstrap-4-modal%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321061%2fhow-to-reset-clean-values-from-a-query-inside-bootstrap-4-modal%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현