Skip to content

Instantly share code, notes, and snippets.

@kborchers
Created December 10, 2012 18:05
Show Gist options
  • Save kborchers/4252203 to your computer and use it in GitHub Desktop.
Save kborchers/4252203 to your computer and use it in GitHub Desktop.
$.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