Affichage d'une variable php
Bonjour,
J’ai un problème simple à résoudre en Ajax, j’ai le code suivant:
accueil.php:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<script src="jquery-2.2.0.js"></script>
<script>
function recherche() {
var recherche=document.getElementById('recherche').value;
$.ajax({
url: "accueil.php",
type:"POST",
data: "recherche="+recherche,
});
}
</script>
<body>
<?php echo $_POST[recherche];?>
<input type="text" name="message" id="recherche" autocomplete="off" oninput="recherche();" placeholder=" Rechercher une personne "/>
</body>
</html> |
Je ne parviens pas à afficher ma variable post recherche, comment cela se fait il ?
Bonne journée