From 5db902b88e0a2a28f796573489d8af2b3052488e Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Tue, 18 Jul 2017 12:14:10 -0400 Subject: [PATCH] Top-search buttons now show 'loading' when the form is loading new fields --- js/app.js | 72 +++++++++++++++++++++++++-------------- js/custom/headerSearch.js | 72 +++++++++++++++++++++++++-------------- 2 files changed, 94 insertions(+), 50 deletions(-) diff --git a/js/app.js b/js/app.js index cf844ad..79e3a9a 100644 --- a/js/app.js +++ b/js/app.js @@ -12,7 +12,7 @@ $(document).foundation(); $(document).ready(function () { var page = $('body'); var header_search = page.find( '.header-search' ); - + var json_search = window.search; var search_fields = []; for( var i in json_search ) { @@ -27,8 +27,10 @@ $(document).ready(function () { var parks = page.find('.park-search'); var category_loader = page.find('.category-loader'); var location_loader = page.find('.location-loader'); + var location_button = page.find('.location-search-form .search-button'); + var category_button = page.find('.category-search-form .search-button'); var selected_item; - + function get_select_text(el){ var text = $(el + ' option:first-child').text(); return text; @@ -47,12 +49,12 @@ $(document).ready(function () { }); $('.header-search.' + selectId).html(soptions).prepend(foption); } - + }; // sortDropDownListByText('county-search', true); // -// +// // sortDropDownListByText('county-search', false); @@ -76,20 +78,24 @@ $(document).ready(function () { }, beforeSend: function(){ cities.prop('disabled','disabled'); + location_button.prop('disabled','disabled'); + location_button.attr('value','Loading...'); city_text = get_select_text('.header-search.city-search'); $('.city-search option:first-child').text("Loading..."); }, complete: function(){ cities.prop('disabled',false); + location_button.prop('disabled',false); + location_button.attr('value','Search'); }, success:function(data){ var county_data = data; - + // $('option:selected', this).attr('selected', 'selected'); option = {}; cities.empty(); cities.append($('