title: How to get a modal when a checkbox is selected?
body: <p>Here are my codes</p>
  
  <p><strong>ex1.php</strong></p>
  
  <pre><code>&lt;body&gt;
  
  &lt;form&gt;
  
    &lt;label&gt;
      &lt;input type="checkbox" value="LH" name="name"&gt;LH&lt;/label&gt;
    &lt;label&gt;
      &lt;input type="checkbox" value="LJ" name="name"&gt;LJ&lt;/label&gt;
    &lt;label&gt;
      &lt;input type="checkbox" value="LL" name="name"&gt;LL&lt;/label&gt;
    &lt;label&gt;
      &lt;input type="checkbox" value="FA" name="name"&gt;FA&lt;/label&gt;
    &lt;label&gt;
      &lt;input type="checkbox" value="FB" name="name"&gt;FB&lt;/label&gt;
    &lt;label&gt;
      &lt;input type="checkbox" value="FU" name="name"&gt;FU&lt;/label&gt;
  &lt;/form&gt;
  
  &lt;!--modal--&gt;
  &lt;div id="myModal" class="modal fade" role="dialog"&gt;
    &lt;div class="modal-dialog"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title"&gt;Modal Header&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;?php
  
          $test = $_POST['test'];
  
          $servername = "localhost";
          $username = "root";
          $password = "";
  
  
  // Create connection
          $conn = mysqli_connect($servername, $username, $password);
  
  
  // Check connection
          if (!$conn) {
          die("Connection failed: " . mysqli_connect_error());
          }
          echo "Connected successfully";
  
          mysqli_connect_db("db",$conn);
  
          $sql = "SELECT Subcat FROM subcat where CatId=".$test." ";
          $res = mysqli_query($conn,$sql);
          while($row = mysqli_fetch_assoc($res)){
          echo "&lt;input type='checkbox' name='category[]' value='".$row['Subcat']."'&gt;"
          .$row['Subcat'];
          echo "&lt;br&gt;";   
  }
          ?&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>ex1.js</strong></p>
  
  <pre><code>$document.ready(function(){
      $(":checkbox").click(function(){
          var value_ck = $(this).val();
          $.ajax(
              url:"ex1.php",
              type:"post",
              data:{test:value_ck},
              success:function(){
                  $("#myModal").modal();
  
  
  
  
                  });
      });
  });
  </code></pre>
  
  <p>What I want to do here is as follows</p>
  
  <p>I have a checkbox list in the form. When I click a checkbox ,a modal should appear with corresponding data coming from the database.I am a very beginner to <code>Jquery</code>. My codes are not working.I Found solutions everywhere to fix that. but I was unable .</p>
  
  <p>Could anyone please to help me?</p>