2
我通過URL傳遞一個頁面的對象到另一個GET方法是這樣的:
var url = "home-page?file="+encodeURIComponent(JSON.stringify(file));
使用Javascript - 訪問對象
在頁面home-page
我GET方法後打開,我收到的JavaScript對象:
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(window.location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
.
var file = getParameterByName('file');
這樣的:
{ 「節點」:{ 「isLink」:假的, 「isContainer」:假的,...
但我不能訪問isLink值...我試圖做
file.node.isLink
但這,並不返回任何內容。
任何人都知道我該如何訪問它?
'VAR OBJ = JSON.parse(文件);' –
,對不起,我錯了。現在我可以做到!它解決了我的問題!你可以把答案;) – PRVS
答覆補充,謝謝。 –