function autoComplete(s) { $.ajax({ url: MyAjax.ajaxurl, type: "GET", data: { 'action': 'get_search_autocomp', 's': s, }, dataType: "html", success: function (data) { $('#search-section .ac-search-results').html(data); }, error: function (errorThrown) { console.log(errorThrown); } }); }