Created
September 28, 2013 00:49
-
-
Save loopymonkey/6737149 to your computer and use it in GitHub Desktop.
Jquery ajax json load reference
This file contains 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
$(document).ready(function() { | |
/* | |
/* Load json on click | |
/*/ | |
$('#element').on('click', function(e){ | |
$.ajax({ | |
type: 'GET', | |
url: 'api/myjsonlink.json', | |
dataType: 'json', | |
cache: false, | |
success: function(data) { | |
var element = $('#wherejsonparsedwillgo'); | |
data.forEach(function(myItem) { | |
element.append('<div>' + myItem.myContent + '</div>'); | |
}); | |
} | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment