[英]fetch json array and append data in another page
I am trying to pass a json array to another page with jquery and on that another page I want to bind the data to the respective element.This is my ajax request: 我正在尝试使用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));
});
This is the json response from the url that i receive: 这是我收到的url的json响应:
{
"data": [
{
"full_name": "xxxx",
"employee_id": "xxxxx",
"imageUrl": "xxxx",
"dname": "xxxx"
},
{
"full_name": "xxxxx",
"employee_id": "xxxxx",
"imageUrl": "xxxx",
"dname": "xxxx"
}
]
}
Use data not data(data) 使用数据而不是数据(数据)
Following information might help you URL encoding refer below, 以下信息可能会帮助您参考以下URL编码,
https://en.wikipedia.org/wiki/Percent-encoding https://zh.wikipedia.org/wiki/百分比编码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.