javascript - Knockout.js and REST -


i'm testing knockout.js mvvm framework. , want pull data restful service. have connected service , it's getting data reason it's not binding page. i'm not sure if i'm doing incorrectly after use ajax call data. here .js file:

function messagecountdatamodel() {      var self = this;     var allcounts = (function (){      var json = null;      $.ajax({         'async': false,         'global': false,         'url': "http://localhost:8080/api/getstats.json",         'datatype': "json",         'success': function(data){             json = data;         }                 });         return json;    }) ();    }     ko.applybindings(new messagecountdatamodel()); 

and here bindings part of html page:

<body>     <div data-bind="foreach: statlist">         typecount: <strong data-bind="text: typecount"></strong>, priority: <strong data-bind="text: sentdate"></strong>         <br/> </div>     <script src="js/knockout-2.1.0.js" type="text/javascript"></script>     <script src="js/jquery-1.11.0.js" type="text/javascript"></script>     <script src="models/messagecount.js" type="text/javascript"></script>  </body> 


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -