I try to pass my data into Backbone.Collection
without using url
. I just have a response with array of objects and what I need is to pass a variable into url
. But url
is a path in a working directory to a json file or a url to the server. So how can I pass my variable instead of url?
var test = [{
"name": "Afghanistan",
"url": "http://en.wikipedia.org/wiki/Afghanistan",
"pop": 25500100,
"date": "2013-01-01",
"percentage": 0.36,
"id": 1
}, {
"name": "Albania",
"url": "http://en.wikipedia.org/wiki/Albania",
"pop": 2831741,
"date": "2011-10-01",
"percentage": 0.04,
"id": 2
}];
var Territory = Backbone.Model.extend({});
var Territories = Backbone.Collection.extend({
model: Territory,
url: "scripts/test.json" // there should be pass to my variable "test"
});