I have a Ajax function which should call search-engine.php but nothing happen.
Here my code:
Ajax:
$.ajax(){
type: 'POST',
url: 'search-engine.php',
data: {userInput: searchInput},
success: function(){
alert('works');
},
error: function(){
alert('something went wrong');
}
}
PHP:
<?php
$userInput = $_POST("userInput");
echo $userInput;
?>
And my input is inside a form tag with method post. If is important.