javascript - Binding JSON file with Knockout.js using ko.mapping.JS() -


I have a JSON file. The server often updates the JSON file whenever the JSON file is updated, then my view data should be automatically updated.

This is my script

  var initData = [{Sahara: Ko.SourceWeb ("text")}]; Var VisualModel = {Statistics: Ko.Mapping.frames (Intadata)}; Ko.applyBindings (ViewModel); SetInterval (function () ($ .getJSON ('sample.json', function (newrzult) {var newfunction = ko.mapping.fromJS (newResult.Data); visiblemodel.stats (newfunction);});}, 1000 );  

What do I need: I am using the Interlayeweave function set here to update the view for every second, which works fine But I have to be a listener, who hears whether the JSN has been updated by the server and when the listener realizes that Jason File Server If the update is done, then it should trigger the 'Update View function'.

How can I do this here is my body

  
Data --Bind = "foreach: stats" & gt; & lt; input type = "text" data-bound = "value: support" onclick = "startRefresh ()" />

Here is my JSON file

  {"data": [{"prop": 1322}, {"prop": 1322}]}  


Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -