Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--Searching script-->
- <link href="css/searchbox.css" rel="stylesheet">
- <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $('.search-box input[type="text"]').on("keyup input", function(){
- /* Get input value on change */
- var emergencyRadio = document.getElementById("emergencySearch").checked;
- var inputVal = $(this).val();
- var resultDropdown = $(this).siblings(".result");
- if(inputVal.length){
- if (emergencyRadio == true){
- window.alert("Use of the emergency search will be logged");
- $.get("scripts/emergency-search.php", {term: inputVal}).done(function(data){
- // Display the returned data in browser
- resultDropdown.html(data);
- });
- } else {
- $.get("scripts/backend-search.php", {term: inputVal}).done(function(data){
- // Display the returned data in browser
- resultDropdown.html(data);
- });
- }
- } else{
- resultDropdown.empty();
- }
- });
- });
- </script>
- <?php
- if (isset($_SESSION["staffID"])) {
- echo '
- <li class="nav-item">
- <form class="form-inline my-2 my-lg-0 mr-lg-2">
- <div class="search-box">
- Emergency search:<input type="radio" id="emergencySearch">
- <input type="text" autocomplete="off" placeholder="Search patient">
- <div class="result"></div>
- </div>
- </form>
- </li>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement