From: Anthony Talarico Date: Thu, 27 Apr 2017 13:54:24 +0000 (-0400) Subject: adding test round of header search filters for categories X-Git-Tag: v1.0.0^2~120 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=7920dde13e47c81c08136ba470dd2c64eee63d70;p=WP-Themes%2Fmichigantrailmaps.git adding test round of header search filters for categories added ajax and php search filtering using sql queries in the ajax search file and the headSearch js file. this should filter the categories based on user selection --- diff --git a/js/app.js b/js/app.js index c922d08..c336853 100644 --- a/js/app.js +++ b/js/app.js @@ -20,7 +20,7 @@ $(document).ready(function () { } - var activities = page.find('#activities-search'); + var activities = page.find('#activity-search'); var counties = page.find('#county-search'); var cities = page.find('#city-search'); var regions = page.find('#region-search'); @@ -106,22 +106,23 @@ $(document).ready(function () { }); // categories on change -// activities.on('change', function(){ -// $('option:selected', this).attr('selected', 'selected'); -// var activity = this.value; -// var taxonomy = $('option:selected', this).attr('data-taxonomy'); -// jQuery.ajax({ -// type:"POST", -// dataType: 'json', -// url: ajaxurl, -// data: { -// action: "trailmaps", -// activity: activity, -// taxonomy: taxonomy -// }, -// success:function(data){ -// var activity_data = data; -// + activities.on('change', function(){ + $('option:selected', this).attr('selected', 'selected'); + var activity = this.value; + if(activity === ''){ + activity = 'false'; + } + jQuery.ajax({ + type:"POST", + dataType: 'json', + url: ajaxurl, + data: { + action: "trailmaps", + activity: activity, + + }, + success:function(data){ + var activity_data = data; // option = {}; // $('#trail-counties option').not(':eq(0), :selected').remove(); // var selected = $('#trail-counties option:selected').val(); @@ -133,8 +134,8 @@ $(document).ready(function () { // counties.append(option); // } // }); -// -// + + // option = {}; // $('#trail-cities option').not(':eq(0), :selected').remove(); // var selected = $('#trail-cities option:selected').val(); @@ -147,41 +148,49 @@ $(document).ready(function () { // cities.append(option); // } // }); -// -// if( $('#trail-activities option:selected').val() === 'default'){ -// option = {}; -// activities.empty(); -// activities.append($('