Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <!--Searching script-->
  2. <link href="css/searchbox.css" rel="stylesheet">
  3. <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  4. <script type="text/javascript">
  5. $(document).ready(function(){
  6. $('.search-box input[type="text"]').on("keyup input", function(){
  7. /* Get input value on change */
  8. var emergencyRadio = document.getElementById("emergencySearch").checked;
  9. var inputVal = $(this).val();
  10. var resultDropdown = $(this).siblings(".result");
  11. if(inputVal.length){
  12. if (emergencyRadio == true){
  13. window.alert("Use of the emergency search will be logged");
  14. $.get("scripts/emergency-search.php", {term: inputVal}).done(function(data){
  15. // Display the returned data in browser
  16. resultDropdown.html(data);
  17. });
  18. } else {
  19. $.get("scripts/backend-search.php", {term: inputVal}).done(function(data){
  20. // Display the returned data in browser
  21. resultDropdown.html(data);
  22. });
  23. }
  24. } else{
  25. resultDropdown.empty();
  26. }
  27. });
  28. });
  29. </script>
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. <?php
  40. if (isset($_SESSION["staffID"])) {
  41. echo '
  42. <li class="nav-item">
  43. <form class="form-inline my-2 my-lg-0 mr-lg-2">
  44. <div class="search-box">
  45. Emergency search:<input type="radio" id="emergencySearch">
  46. <input type="text" autocomplete="off" placeholder="Search patient">
  47. <div class="result"></div>
  48. </div>
  49. </form>
  50. </li>';
  51. }
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement