Skip to content

Instantly share code, notes, and snippets.

Created February 7, 2011 16:28
Show Gist options
  • Save anonymous/814661 to your computer and use it in GitHub Desktop.
Save anonymous/814661 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<script type="text/javascript" src="jquery.js"></script>
<script>
$(document).ready(funtion(){
$('.loader').hide();
$('#search').keyup(function)(){
$field = $(this);
$('#result').html('');
if($field.val().length>1)
{
$.ajax({
type: 'POST',
url:'search.php',
data:'search='+$('#search').val(),
beforeSend:function(){
$('.loader').stop().fadeInd();
},
success: function(data){
$('.loader').fadeOut();
$('#result').html(data);
}
});
}
});
});
</script>
<title>Document sans titre</title>
</head>
<body>
<div id="content">
<form action="search.php" methode"post">
<label for="search">Recherche:</label>
<input type="text" name"search" id="search" />
<div class="loader"></div>
</form>
<div id="result"></div></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment