Моя форма:
Код: Выделить всё
Код: Выделить всё
jQuery(document).ready(function(){
(function($){
$(".keyword-search").keypress(function(){
var keyword = $(this).val();
$(".search-appear").empty();
$.ajax({
type: "post",
url: "",
data: { action: 'get_tour', keyword: keyword },
beforeSend: function() {$("#loading").fadeIn('slow');},
success: function(data) {
$("#loading").fadeOut('slow');
$(".search-appear").append(data);
}
});
});
})(jQuery);
});
Код: Выделить всё
function get_tour()
echo 'Do something!';
?>
Подробнее здесь: [url]https://stackoverflow.com/questions/43788120/live-search-with-jquery-ajax[/url]