I made an ajax function so my page wont refresh and my search window wont disappear on form submit. It works fine in all browsers but it keeps refreshing on Safari.
Here is my code:
{% if not craft.request.isAjax %}
{% set pagingJs %}
$(function () {
$('#searchBtn').click(function (e) {
$( ".searchResult" ).remove();
$( ".noResult" ).remove();
e.preventDefault();
var search = $('#searchField').val();
$('#loading').show();
$.get( "/?q="+search, function( data ) {
data = $('#searchQuery', data).html();
$( "#searchQuery" ).append(data);
});
});
});
$( document ).ajaxStop(function() {
$('#loading').hide();
});
{% endset %}
{% includeJs pagingJs %}
{% endif %}