Skip to content

Instantly share code, notes, and snippets.

@hugodias
Created October 5, 2012 17:25
Show Gist options
  • Save hugodias/3841157 to your computer and use it in GitHub Desktop.
Save hugodias/3841157 to your computer and use it in GitHub Desktop.
Easy manipulate ajax data with jquery
$('.btn').click(function(){
ajaxGET('http://my-url',function(data) {
// Manipulate your ajax data here
console.log( data )
});
})
function ajaxGET( url, callback ) {
return $.ajax({
url: url ,
type: 'GET',
cache: true,
success: function(data){
callback(data);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment