Thursday 15 May 2014

windows 8 - Create JSON File in local folder -


I'm working on a Windows 8 app, and a name for my purpose and make a json file with the appropriate location the app and finally the database, I could have been using the Jason file to be linked to Telrik chart and populate the data.

In the code snippet below, "GetAutomationPageStaticGroups" a function in my controller that json file will retrieve

  function createJsonFile () {WinJS.xhr ({url. : APIUL + "GetAutomationPageStaticGroups"}}};   

My query is how a proper name to modify the above snippet and to store that json file in the correct location within the application?

Assuming that WinJS.xhr code that you have shared Working - The following code can be used to save data in a file as 'data' Local data under the 'Json app'

  var storage = Windows.Storage; Var data; WinJS.xhr (({url: apiUrl + "GetAutomationPageStaticGroups"}.) Then (function Oncomplete (request) {data = req.responseText; return storage.ApplicationData.current.localFolder.createFileAsync ( 'data.json', storage.CreationCollisionOption .replaceExisting);} then (function oncreatecomplete {file} {return storage.FileIO.writeTextAsync (file, data, storage.Streams.UnicodeEncoding.utf8);}) then (zero, function onerror (error) {// TODO. : Handle error here}}    

No comments:

Post a Comment