I am trying to assign a value to a variable with json (returned from server side). I do not want to use ember-data to manage the models and define the RestAdapter, since it is still in beta.
App.ExamplesRoute = Ember.Route.extend({
beforeModel: function() {
var request = $.post("/Example/GetExamples");
request.then(this.success.bind(this), this.failure.bind(this));
},
success: function(data) {
var examples=data;
alert(example);
if(examples==null){
alert('examples are null');
}
},
failure: function() {
alert('failed');
},
model: function() {
return examples;
}
});
I am basically trying to assign the value to the examples variable from a json object. The problem is that I get a javascript error saying that the examples are not defined in the model: function () {return examples; }}); So what would be the right way to do this?
source
share