$(function(){setTimeout(function (){ let searchWidget = $('[data-component-dynamicsearch]'); console.log("searchWidget", searchWidget.find('input[name="keyword"]')); var urlParams = new URLSearchParams(window.location.search); let searchedKeyword = ''; let searchedFilters = ''; if(urlParams.has('s')){ searchedKeyword = urlParams.get('s'); } if(urlParams.has('filters')){ searchedFilters = urlParams.get('filters'); searchedFilters = searchedFilters.split(';'); } searchWidget.each(function (){ selfSearchWidget = $(this); if(searchedKeyword !=''){ selfSearchWidget.find('input[name="keyword"]').val(searchedKeyword); } if(searchedFilters){ $.each(searchedFilters, function (key, value) { if (value) { let optValue = value.split(':'); let filterName = optValue[0]; let filterVal = optValue[1]; selfSearchWidget.find('select[name="'+filterName+'"]').val(filterVal); } }); } let keyword = ''; keyword = selfSearchWidget.find('input[name="keyword"]').val(); let selectedObj = selfSearchWidget.attr("data-selected-obj"); let map_fields = selfSearchWidget.attr("data-mapFields"); let success_redirect = selfSearchWidget.find('input[name=success_redirect]').val(); let all_filters = ''; let filtersQS = ''; if(!success_redirect){ success_redirect = window.location.href; } if (selfSearchWidget.find('.search-filters').length > 0) { all_filters = selfSearchWidget.find('.search-filters').find('select'); all_filters.off().on('change', function(){ $(this).attr('title', $(this).val()); let QS = $(this).attr('name')+':'+$(this).val(); $(this).attr('data-qs', QS); filtersQS = ''; let filtersArr = []; all_filters.each(function(){ if($(this).attr('data-qs')){ filtersArr.push($(this).attr('data-qs')); } }); filtersQS = filtersArr.join(';'); let keyword = ''; keyword = selfSearchWidget.find('[name="keyword"]').val(); let prepSrc = ''; if (success_redirect && selectedObj) { prepSrc = success_redirect+'?s='+keyword+'&obj='+selectedObj; if(map_fields && map_fields != ''){ prepSrc += '&mapFields='+map_fields; } prepSrc += '&filters='+filtersQS; selfSearchWidget.find('.searchBtn').attr('href', prepSrc); }else{ selfSearchWidget.find('.searchBtn').attr('href', 'javascript:void(0)'); } }); } if (success_redirect && selectedObj) { prepSrc = success_redirect+'?s='+keyword+'&obj='+selectedObj; if(map_fields && map_fields != ''){ prepSrc += '&mapFields='+map_fields; } prepSrc += '&filters='+filtersQS; selfSearchWidget.find('.searchBtn').attr('href', prepSrc); }else{ selfSearchWidget.find('.searchBtn').attr('href', 'javascript:void(0)'); } selfSearchWidget.find('[name="keyword"]').on('change textInput input', function(){ let keyword = ''; keyword = $(this).val(); let prepSrc = ''; if (success_redirect && selectedObj) { prepSrc = success_redirect+'?s='+keyword+'&obj='+selectedObj; if(map_fields && map_fields != ''){ prepSrc += '&mapFields='+map_fields; } prepSrc += '&filters='+filtersQS; selfSearchWidget.find('.searchBtn').attr('href', prepSrc); }else{ selfSearchWidget.find('.searchBtn').attr('href', 'javascript:void(0)'); } }); selfSearchWidget.find('[name="keyword"]').on('keyup', function(e){ if (e.key === 'Enter' || e.keyCode === 13) { let keyword = ''; keyword = $(this).val(); let prepSrc = ''; if (success_redirect && selectedObj) { prepSrc = success_redirect+'?s='+keyword+'&obj='+selectedObj; if(map_fields && map_fields != ''){ prepSrc += '&mapFields='+map_fields; } prepSrc += '&filters='+filtersQS; window.location.href = prepSrc; }else{ selfSearchWidget.find('.searchBtn').attr('href', 'javascript:void(0)'); } } }); }); }, 2000);});
Recent searches
Popular Articles on Profitsanspizza
More than 100 Articles for savvy entrepreneurs.
About Us
Profits And Pizza is dedicated to empowering entrepreneurs with education, tools, services, advice, and consulting. Our mission is to maximize profits and drive success in their ventures. Trust us as your partner, providing business wisdom and customized resources for your scrappy entrepreneurial businesses. At Profits And Pizza, we leverage our expertise to provide tailored business wisdom, tools, and resources for your scrappy entrepreneurial ventures. Our goal is to ensure your success and foster continuous growth in your business endeavors. Trust us to be your dedicated partner on the path to prosperity.
Wisdom
Using wisdom, achieving success through clarity.
Tools
Empowering entrepreneurs with the right tools for success
Resources
Fueling entrepreneurs with vital growth resources.
A Successful Business with Right Tools & Resources
Whether your focus is on determining career direction, conducting a job search or improving work performance, you Whether your focus is on determining career direction, conducting a job search or improving work performance, you
Articles
Explore our extensive collection of educational articles designed to foster personal growth and development.