var coaches = []; var locations = []; var postcode = ""; var geslacht = ""; var naam = ""; var tags = ""; var land = ""; var map; var markers = []; window.onload = function() { setPostcode(); setNaam(); setTags(); setGeslacht($('.geslachSelect').val()); setLand($('.landSelect').val()); }; $( document ).ready(function() { setTimeout(function(){ ajaxCall(); }, 300); $('.geslachSelect').on('select2:select', function(){ setGeslacht($(this).val()); ajaxCall(); }); $('.landSelect').on('select2:select', function(){ setLand($(this).val()); ajaxCall(); }); $('.checkboxesGroup .check input').on('change', function(){ setTags(); ajaxCall(); }); $(".submitButton").on("click", function(){ $(this).parent("form").submit(); }); $(".responsiveFilters").on("click", function(){ $(".filterOverlay").addClass("active"); }); $(document).on("click",".filterOverlay .close, .filterOverlay .background", function() { $(".filterOverlay").removeClass("active"); setPostcode(); setNaam(); setTags(); ajaxCall(); }); if($(window).width() < 701){ $(".coachesOverviewBlock .col .fieldWrapper").remove(); } else { $(".filterOverlay").remove(); } }); function setGeslacht(val){ geslacht = val; } function setLand(val){ land = val; } function setPostcode(){ postcode = $(".searchPostcode input").val(); } function setNaam(){ naam = $(".searchNaam input").val(); } function setTags(){ var tagsArray = []; $('.checkboxesGroup .check input').each(function(i, el){ if($(el).is(":checked")){ tagsArray.push($(el).attr("name")+ "=on"); } }); tags = tagsArray.join("&"); } function ajaxCall(){ //console.log('test'); } function setCoachesHTML(){ var html = ""; $(".coachesOverviewBlock .coaches").html(""); $(coaches[0]).each(function(i, el){ html += "