Created
May 30, 2014 15:36
-
-
Save filipkral/45b49cad4d23fb211632 to your computer and use it in GitHub Desktop.
basic jQuery get, post, ajax
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
// get | |
function yay(a,b,c){ console.log(['yay', a, b, c]); } | |
function nay(a,b,c){ console.log(['nay', a, b, c]); } | |
$.get({url: 'http://foo.bar/spam?eggs=1', dataType:'jsonp'}).done( yay ).fail( nay ); | |
$.post("http://foo.bar/spam", {eggs: 1} ).done( yay ).fail( nay ); | |
var jqxhr = $.ajax( {url:"http://foo.bar/spam", data: {}, method: 'GET', dataType: 'jsonp'}).done( yay ).fail( nay ).always(function() { console.log( "always" ); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment