2017-02-15 37 views
0

我有以下腳本從SharePoint列表視圖中檢索數據。 我可以獲取數據並顯示,但是我想要下載json文件中的數據。 每當任何用戶點擊具有此腳本的頁面時,它都會提示他們保存JSON文件。在JSON SharePoint列表項目中提示用戶下載

這裏是我的腳本功能,輸出json格式的數據。我只需要創建一個JSON文件指出,數據和下載的文件

 getListViewItems('https://mysite','mylist','myview').done(function(data) 
    { 
     console.log(JSON.stringify(data)); 
     // data is the json result i want and i can print this to 
     // console or display in the page but i want to add this to 
     // a json file and make it downloadable. 
    }) 
    .fail(
    function(error){ 
    console.log(JSON.stringify(error)); 
    }); 

回答

0

這個鏈接可以幫助你 Download JSON object as a file from browser (見接受的答案)

正如你說你已經有一個json文件與你和這個鏈接將給你一個提示如何點擊動態生成的鏈接並下載文件。

謝謝

+0

它的工作原理,但它不起作用在IE瀏覽器。由於URI字符的限制 – user388969

相關問題