ok
Direktori : /home/ngwcolle/public_html/LIBRARY-NGWC/ |
Current File : /home/ngwcolle/public_html/LIBRARY-NGWC/search.php |
<?php include_once('includes/config.php'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="description" content="" /> <meta name="author" content="" /> <title>NGWC | Library</title> <!-- Favicon--> <link rel="icon" type="image/x-icon" href="assets/favicon.ico" /> <!-- Core theme CSS (includes Bootstrap)--> <link href="css/styles.css" rel="stylesheet" /> </head> <body> <!-- Responsive navbar--> <?php include_once('includes/header.php') ?> <!-- Page Content--> <div class="container px-4 px-lg-5"> <!-- Heading Row--> <!-- Content Row--> <div class="row gx-4 gx-lg-5"> <div class="col-md-12 mb-5"> <div class="card h-100 p-2 mt-5"> <div class="card-body"> <h2 class="card-title">Online Book Search in Libray</h2> <form> <div class="p-2 text-danger"><h3></h3></div> <div class="input-group mb-3"> <input type="text" id="search" class="form-control form-control-lg" placeholder="Search Books by Author Name/ Book Name / Publisher" autocomplete="off"> <input type="submit" id="submit" name="submit" class="btn btn-primary"> </div> <div id="list"></div> </form> </div> <div class="row justify-content-center"> <div class="col-md-11 col-sm-10"> <div id="card"> </div> </div> </div> </div> </div> </div> </div> <!-- Footer--> <?php include_once('includes/footer.php') ?> <!-- Bootstrap core JS--> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <!-- Core theme JS--> <script src="js/scripts.js"></script> <script src="js/jquery-3.5.1.min.js"></script> <script> $(document).ready(function() { $("#search").keyup(function(e) { $("#card").html(""); var search_query = $(this).val(); if (search_query != "") { $.ajax({ url: "ajax-live-search.php", type: "POST", data: { search: search_query }, success: function($data) { $("#list").fadeIn('fast').html($data); } }); } else { $("#list").fadeOut(); } }); }); </script> <script> $(document).ready(function() { $(document).on("click", "#list li", function() { $("#search").val($(this).text()); $("#list").fadeOut(); }); }); </script> <script> $(document).ready(function() { $("#submit").on("click", function(e) { e.preventDefault(); $("#card").html(""); var search_query = $('#search').val(); $.ajax({ url: "autocomplete.php", type: "POST", data: { search: search_query }, success: function($data) { $("#card").fadeIn('fast').html($data); } }); $("#search").val(""); }); }); </script> </body> </html>