Jump to content

Six_Actual

New Members
  • Posts

    2
  • Joined

  • Last visited

Six_Actual's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am trying to make my div (floating-sidebar) appear at the top when the user scrolls down the page, and once the user scrolls to the top, the element should not overlap the nav bar. I am struggling to implement this, so help would be appreciated. This is what I have tried: <div id="floating-sidebar-sticky-wrapper" class="floating-sidebar-wrap" style="height: 696px;"> <div id="floating-sidebar"></div> </div> <script> $(window).on('load',function(){ $("#floating-sidebar").sticky({ topSpacing: 0, wrapperClassName: "floating-sidebar-wrap" }); }); </script>
  2. I am trying to load customer names into a select drop-down list. The first drop down list should result in the second drop down list being updated. However, I am struggling to achieve this, as the list remains empty (only displays Select). <select class="form-control" id="typelist" name="typelist" onchange="get_namelist()";> <option value="cases">Case</option> <option value="processors">Processor</option> </select> <div id="get_namelist"></div> <script type="text/javascript"> function get_namelist() { // Call to ajax function var typelist = $('#typelist').val(); var dataString = "typelist="+typelist; $.ajax({ type: "POST", url: "mysubselect.php", data: dataString, success: function(html) { $("#get_namelist").html(html); } }); } </script> mysubselect.php: <?php include "config.php"; if ($_POST){ $list = $_POST['typelist']; echo("<script>console.log('PHP: ".$list."');</script>"); if ($list != '') { $sql = "SELECT name FROM parts WHERE type=" . $list; $result = $link->query($sql); echo "<select class='form-control' name='partlist'>"; echo "<option value=''>Select</option>"; while($row = $result->fetch_assoc()) { echo "<option value='".$row['name']."'>".$row['name']."</option>"; } echo "</select>"; } else{ echo ""; } } ?> The second list is empty and only outputs Select. What am I doing wrong? Thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.