我有一个返回对象数组的ajax请求,我需要将它们返回到另一页进行打印。但我不知道如何将这个对象数组传递给另一个选项卡或页面。JS - 将对象数组传递到新窗口
$.ajax({
type: "POST",
url: "atualizeOrder",
data: JSON.stringify(ordens),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(list) {
console.log(list);
var printWindow = window.open('/erp/index/test');
printWindow.document.write(list);
printWindow.addEventListener('load', function(){
printWindow.print();
printWindow.close();
}, true);
}
});
什么是你的代码目前呢? – 4castle
用这个返回一个新窗口:[object Object] – scooby
尝试使用'printWindow.document.write(JSON.stringify(list));' – 4castle