Created
October 5, 2012 17:25
-
-
Save hugodias/3841157 to your computer and use it in GitHub Desktop.
Easy manipulate ajax data with jquery
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
$('.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