javascript - Instant Search using google api with php -


i had been working on instant search in php using google jquery api . in youtube video program working (because learning video) . database logic correct because tried in simple html page. not working on jquery. please give me suggestion shot out problem. working on ubuntu 14.04.

this jquery contained php page.

<!doctype html> <html>     <head>     <title>webpage</title>     <script type=text/javascript src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>     <script type=text/javascript>     function searchq() {                  var searchtxt = $("input[name='search']").val();             $.post('search.php', {search_term: searchtxt}, function(output){                     $('#output').html(output);             });      }     </script>     </head>     <body>     <form action="index.php" method="post">             <b> first name: </b> <br/>             <input type="text" name="search" id="search1" placeholder="search members ..." onkeydown="searchq();">             <br/> <br/> <b> submit: </b>             <input type="submit" name="submit">     </form>     <div id="output"></div>     </body> 

my date connectivity page follows

<!doctype html> <html>     <head>     <title>webpage</title>     </head>     <body>     <?php             $connection = mysqli_connect("localhost", "root", "password");             $output = "search results. <br/> <br/>";             if(isset($_post["search_term"])){                     $name = $_post["search_term"];                     $sql = "select cust_id, last_name, first_name, email widget_corp.customer first_name '%"                             . $name . "%' or last_name '%" . $name . "%'";                     $result = mysqli_query($connection, $sql);                     $count = mysqli_num_rows($result);                     if($count == 0){                             echo "there no search results.";                     }                     else {                             while($row = mysqli_fetch_assoc($result)){                                     $firstname = $row["first_name"] . "  ";                                     $lastname =  $row["last_name"] . "  ";                                     $email = $row["email"] ;                                     $output .= '<div>'.$firstname.' '.$lastname.'</div>';                             }                     }             }             echo ($output);     ?>     </body> 


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

http - Safari render HTML as received -