Can't get data from model to appear in template Ember.js -


my code here: http://jsfiddle.net/fnn4r/4/ can't outgoings model (a model messages outbound) display in template.

html

<script type="text/x-handlebars" data-template-name="messages">     hello <b>{{app.username}}</b><br />     {{#each outgoings in model}}     <h4>{{outgoings.vehicle_reg}}</h4>     <p>{{outgoings.message_subject}}</p>     {{/each}} </script> 

js

app.messagesroute = ember.route.extend({     model: function() {         return app.outgoings.all();     },     rendertemplate: function() {         this.render('header-messages', {             into: 'application',             outlet: 'header'         });         this.render('messages', {             into: 'application',             outlet: 'content'         });     } });  app.outgoings = ember.object.extend();  app.outgoings.reopenclass({     all: function() {         var outgoings = [];         var apipage = "messages";         var parameters_string = "action=outgoing";         var url = "http://do-web-design.com/clients/carbuddy/index.php/api/";         var url = url + apipage + "?" + parameters_string + "&username=" + "will" + "&password=" + "1234";         // console.log(url);         var response = $.ajax({             type: "get",             url: url,             datatype: "text json",             success: function(data){                 return data;                 // return json.parse(data)                 alert('its working');   //it alert when ajax call returns successfully.             },             error: function(jqxhr, textstatus, errorthrown) {                 console.log(json.stringify(jqxhr));                 console.log("ajax error: " + textstatus + ' | ' + errorthrown);             }         }).done(function(response) {             response.foreach( function (outgoing) {                 outgoings.push( app.outgoings.create(outgoing) );             });         });         return outgoings;     } }); 

my ajax call getting data not copying model , or sending template.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -