簡體   English   中英

獲取json數組並將數據附加到另一頁中

[英]fetch json array and append data in another page

我正在嘗試使用jQuery將json數組傳遞到另一個頁面,並且在另一個頁面上我想將數據綁定到相應的元素。這是我的ajax請求:

$.ajax({
    type: "GET",
    url: 'url of the php page',
    data: {'json':jsondata},
    dataType :'json',
    async: false,
    encode: true
}).done(function(data) {
    window.location.href = 'anotherpageurl?res='+encodeURIComponent(JSON.stringify(data));
});

這是我收到的url的json響應:

{
"data": [
{
"full_name": "xxxx",
"employee_id": "xxxxx",
"imageUrl": "xxxx",
"dname": "xxxx"
},
{
"full_name": "xxxxx",
"employee_id": "xxxxx",
"imageUrl": "xxxx",
"dname": "xxxx"
}
]
}

使用數據而不是數據(數據)

以下信息可能會幫助您參考以下URL編碼,

https://zh.wikipedia.org/wiki/百分比編碼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM