SHARE
TWEET

Untitled

a guest Jun 16th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // html & jquery
  2.  <select name="rooftop" id="rooftop" class="selectMenu">
  3.             <option value="">Select an option</option>
  4.             <option value="Yes">Yes</option>
  5.             <option value="No">No</option>
  6.         </select>
  7.  
  8.  
  9.     <button id="barButton">click</button>
  10.  
  11.     <div id="showBars">
  12.  
  13.     </div>
  14.  
  15.  
  16.     <script type="text/javascript">
  17.  
  18.         $(document).ready(function(){
  19.  
  20.                           $("#barButton").click(function() {
  21.                             var selected = $("#rooftop").val();
  22.                             $.ajax({
  23.                                    type: "POST",
  24.                                    url: "your_php_script.php",
  25.                                    data: {selected: selected},
  26.                                    success: function(){
  27.                                    alert("works");
  28.                                    }
  29.  
  30.                             });
  31.                           });
  32.  
  33. // code on your_php_script.php
  34.  echo "<script type='text/javascript'> alert('works1'); </script>";
  35.  
  36.     if(isset($selectd)){
  37.         echo "<script type='text/javascript'> alert('works2'); </script>";
  38.         $sql = "SELECT bar_name, area, hourStart, hourEnd FROM barInfo WHERE rooftop = 1";
  39.         $result = mysqli_query($connection, $sql);
  40.         if (mysqli_num_rows($result) > 0) {
  41.             echo "<table id='list'><tr><th><h3>Name</h3></th><th><h3> Area</h3></th><th><h3>Happy Hour Times</h3></th></tr>";
  42.             while($row = mysqli_fetch_assoc($result)) {
  43.                 echo "<tr> <th> <h6> " . $row["bar_name"] . "</h6> </th> <th> <h6>" . $row["area"] . "</h6> </th> <th> <h6>" . $row["hourStart"] . "-" . $row["hourEnd"] . "</h6> </th> </tr>";
  44.             }
  45.             echo "</table";
  46.         }
  47.  
  48.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top