Created
April 5, 2018 15:10
-
-
Save ScarletPonytail/7a7b23a169fe07dbe8e811f3141d7164 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