Skip to content

Instantly share code, notes, and snippets.

@loopymonkey
Created September 28, 2013 00:49
Show Gist options
  • Save loopymonkey/6737149 to your computer and use it in GitHub Desktop.
Save loopymonkey/6737149 to your computer and use it in GitHub Desktop.
Jquery ajax json load reference
$(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