siva
siva

Reputation: 1

How to make ajax call to get the data from url using backbone js

I am new to backbone js and i wanted to call one external url and i want the which will fetch from the url output.

I have tried like the following

var MyApp.myModel = Backbone.Model.extend({
    url: 'http://senthil_c/DSCFrameWork/UVIndevSvc.svc/GetWeatherByZipcode/02111/json'
});

var MyApp.myView = Backbone.View.extend({
    initialize: function() {
        this.model.bind("change",this.render,this);
        this.model.fetch();
    },
    render: function() {
        alert('do awesome stuff here');
    }
});

I dont know how to call and i dont know this one is correct or not any one suggest me?

Upvotes: 0

Views: 1326

Answers (1)

Sathya
Sathya

Reputation: 5308

initialize: function() {
    this.model = new MyApp.myModel();
    this.model.fetch();
}

Upvotes: 1

Related Questions