jeasyui:如何通过客户端在另一个页面中获取queryparams 第1页(root.html):
$.ajax({
type: "get",
async: true,
url: "/ashx/product/root.ashx",
dataType: 'json',
success: function (res) {
var o = $('#tb');
for (i = 0; i < res.length; i++) {
o.tabs('add', {
title: res[i].Name + '-' + res[i].PkId,
href: '/html/usr/node.html', queryParams: { 'id': res[i].id }
});
o.tabs('select', 0);
}
}
});
第2页(node.html):
<script>
// how to get queryParams from page root.html here in javascript.
alert();
</script>
答案 0 :(得分:0)
使用JSONP
JQUERY
$.ajax({
url:"node.html.html",
dataType: 'jsonp',
success:function(json){
alert("Success");
},
error:function(){
alert("Error Message");
}
});
node.html(请注意我使用php)
<?php
$arr = array("param1",
"param2",
array("param3","param4"));
$arr['name'] = "response";
echo json_encode($arr);
?>