Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
amazon links
jQuery(document).ready(function() {
var attributes = {}
attributes["IT"] = 'data-amazon-it';
attributes["GB"] = 'data-amazon-gb';
var url = " ";
jQuery.getJSON(url, function(data) {
var code = data.country_code;
var links = jQuery('[data-amazon]');
jQuery.each(links, function(index, link) {
var el = jQuery(link);
el.attr('href', el.attr(attributes[code]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.