DanV
DanV

Reputation: 3240

Backbone app is trying to POST

I'm fairly new to Backbone so this is probably an obvious mistake...

I've created a customisable form with a few views. I'm pulling in my config data from config.json through my form collection. In the console I'm getting an error:

'POST http://local.ti-url-builder/js/config.json 405 (Method Not Allowed)'

Any ideas? I'm not doing any POST's (that I'm aware of?). I have a feeling its' related to the way I'm pulling the data:

TAG.FormCollection = Backbone.Collection.extend({

    model: TAG.FormsModel,

    url: "js/config.json",
});

You can view the app here: https://di-campaign.s3.amazonaws.com/redirect/urlbuilder_v2.html

Thanks in advance for any help and useful criticism :)

Upvotes: 0

Views: 34

Answers (2)

Manish Mulimani
Manish Mulimani

Reputation: 17615

I visited the link you shared and saw multiple failed POST requests with HTTP status code 412. Those are getting triggered in form-view.js:

TAG.Section = new TAG.FormSectionCollection();
...
TAG.Section.create( pageAttributes );

The create method of Collection triggers POST request. It saves the model to the server and adds to the collection.

Upvotes: 1

David Sulc
David Sulc

Reputation: 25994

Are you saving a model instance? By default, if you save a model and it doesn't have an id value, a POST request will be sent to the url...

Upvotes: 0

Related Questions