Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP Example - AJAX Live Search

<html>
<head>
<script>
function showResult(str) {
  if (str.length==0) {
    document.getElementById("livesearch").innerHTML="";
    document.getElementById("livesearch").style.border="0px";
    return;
  }
  var xmlhttp=new XMLHttpRequest();
  xmlhttp.onreadystatechange=function() {
    if (this.readyState==4 && this.status==200) {
      document.getElementById("livesearch").innerHTML=this.responseText;
      document.getElementById("livesearch").style.border="1px solid #A5ACB2";
    }
  }
  xmlhttp.open("GET","livesearch.php?q="+str,true);
  xmlhttp.send();
}
</script>
</head>
<body>

<form>
<input type="text" size="30" onkeyup="showResult(this.value)">
<div id="livesearch"></div>
</form>

</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Php :: vs code php tag shortcut 
Php :: php hour between 
Php :: php regex format number with commas and decimal 
Php :: php if time is greater than 
Php :: php get variable by string name 
Php :: call api php 
Php :: Prevent direct url access to php file 
Php :: extend woocommerce user fields edit-account 
Php :: laravel filesystem link 
Php :: php split array into chunks 
Php :: The "AppEntity entity has a repositoryClass set to but this is not a valid class. 
Php :: strpos php 
Php :: how to create constant in php 
Php :: php display json in browser 
Php :: mac install php-fpm 
Php :: laravel set date format 
Php :: add phpmyadmin login linux 
Php :: spaceship operator 
Php :: how to download a file in php 
Php :: how to fetch the sum of column in php mysql 
Php :: Calling itself a static function in php 
Php :: laravel get file to browser send 
Php :: execute script php command line 
Php :: encryption and decryption in php example 
Php :: how to create cookie in laravel 
Php :: laravel validation check foreign key exists 
Php :: how to use uuid in laravel model 
Php :: how to use php 
Php :: what is cors in laravel 
Php :: Clear any previous error php 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =