Created
December 10, 2012 18:05
-
-
Save kborchers/4252203 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$.mockjax({ | |
url: "jsonpTest", | |
type: "GET", | |
response: function( settings ) { | |
this.responseText = "{callback:\"" + settings.data.callback + "\"}"; | |
// or for custom callback | |
this.responseText = "{jsonpOrWhatEverYouCallIt:\"" + settings.data.callback + "\"}"; | |
} | |
}); | |
// Then in the test, JSON.parse the response and make sure callback's value contains jQuery or something like that (since jQuery's generated callback has jQuery in the name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment