How do you set the jsonpCallback function name for the fetch method of backbonejs? To add to the problem is I also using requireJS so i am trying not to have a global function and follow the AMD pattern.
The reason I can't use the auto generated method name from jquery is the developer of the api I am using want's to have a static name of for the callback method for caching reasons.
Sample Code
define([
'jquery',
'underscore',
'backbone',
'marionette',
'paginator',
'models/item'], function($, _, Backbone, Marionette, Paginator, modelItem) {
'use strict';
var PaginatedCollection = Paginator.requestPager.extend({
model: modelItem,
paginator_core: {
jsonpCallback : 'callbackFunc',
type: 'GET',
cache: true,
dataType: 'jsonp',
},
callbackFunc : function(data) {
console.log(data);
}
});
return PaginatedCollection;
});
Error Message
TypeError: callbackFunc is not a function