0

This is basically a request for standards. I have inherited an Backbone / Marionette application that has a number of JSONP requests (Post and GET) being called from methods withing the Views. Is this the standard way of doing things? If not, how should we do it? My assumption would be in a collection??? There are also instances of nested jsonp calls...

var someView = Backbone.Marionette.Layout.extend({
    doSomething : function() {
        jsonp.request({url:url,type:"POST"},function(data){
           // crazy stuff
           jsonp.request({url:data.url,type:"POST"},function(data2){
               // more crazy model updates
           });
        }, null, null, true);
    }
}

I am thinking there should be a method on the model that is being updated that does a the jsonp stuff right?

tereško
  • 58,060
  • 25
  • 98
  • 150
Katherine C
  • 245
  • 2
  • 11

1 Answers1

0

You can't use POST with jsonp. It's only for GET calls. To use jsonp with Backbone, the only thing you do different is pass a { datatype: 'jsonp' } parameter to your fetch() call.

kinakuta
  • 9,029
  • 1
  • 39
  • 48