I’ve been going at this for a solid hour, and I have a feeling it might be something simple. I’m doing a basic model fetch with backbone.js with the code below.
var Document = Backbone.Model.extend({
urlRoot: "/Package/Documents/GetDocumentById/"
});
mydocument = new Document({id: "3978204"});
mydocument.fetch()
I would expect the above code to make a call to the following url
localhost:3000/Package/Documents/GetDocumentById/3978204
But instead it is adding an extra parameter to the query which is blowing up my method.
localhost:3000/Package/Documents/GetDocumentById/3978204?_=1318548585841
I have no idea how ?_=1318548585841 get rid of the extra parameter.
Any help would be apperciated.
Take a look at this related question. This is a cache-buster added by
jQuery.ajax(), which Backbone uses in the background.I believe you can remove this by passing
cache:trueas an option tofetch()(which gets passed to$.ajax()):If that works but you don’t want to do it every time, you could set it globally with jQuery.ajaxSetup().