Created
April 5, 2018 15:10
-
-
Save ScarletPonytail/644d7e3872935233043fd835a63971a3 to your computer and use it in GitHub Desktop.
JS / JQuery - Query array inline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function suggestUserLocation() { | |
if ( getCookie( 'closestLocation' ) !== '' ) { | |
var closestLocation = jQuery.parseJSON( getCookie( 'closestLocation' ) ); | |
var theCountries = [ | |
'Cayman Islands', | |
'Falkland Islands', | |
'Philippines', | |
'UAE', | |
'United Kingdom', | |
'United States' | |
]; | |
jQuery( '#header-country-select .easy-autocomplete-container' ).append( '<div class="siteLocationSuggestion"><div> Are you in ' + ( ( theCountries.indexOf(closestLocation.loc_user) > -1 ) ? 'the ' : '' ) + closestLocation.loc_user + '? Visit <a href="' + closestLocation.loc_weburl + '" target="_blank"> <img src="' + closestLocation.loc_flag + '" /> <span>' + closestLocation.loc_webtext + '</span></a></div></div>' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment