PHP Classes

File: search.php

Recommend this page to a friend!
  Classes of Faris AL-Otabi   Netflix Clone   search.php   Download  
File: search.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Netflix Clone
Manage a library of movies to rent like Netflix
Author: By
Last change:
Date: 2 months ago
Size: 780 bytes
 

Contents

Class file image Download
<?php
include_once("includes/header.php");
?>
<div class="textboxContainer">
    <input type="text" class="searchInput" placeholder="Search for something">
</div>

<div class="results"></div>

<script>

$(function() {

    var username = '<?php echo $userLoggedIn; ?>';
    var timer;

    $(".searchInput").keyup(function() {
        clearTimeout(timer);

        timer = setTimeout(function() {
            var val = $(".searchInput").val();
           
            if(val != "") {
                $.post("ajax/getSearchResults.php", { term: val, username: username }, function(data) {
                    $(".results").html(data);
                })
            }
            else {
                $(".results").html("");
            }

        }, 500);
    })

})

</script>