Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我想用POST数据打开一个新窗口/选项卡,但它';它不工作了_Javascript_Ajax - Fatal编程技术网

Javascript 我想用POST数据打开一个新窗口/选项卡,但它';它不工作了

Javascript 我想用POST数据打开一个新窗口/选项卡,但它';它不工作了,javascript,ajax,Javascript,Ajax,以下是通过PHP生成的调用之一: <script> var copyrecipient = []; var customhintcopy = []; copyrecipient.push('customer'); copyrecipient.push('healthins

以下是通过PHP生成的调用之一:

                    <script>
                      var copyrecipient = [];
                      var customhintcopy = [];
                      copyrecipient.push('customer');
                      copyrecipient.push('healthinsurance');
                      customhintcopy.push('4');
                      customhintcopy.push('6');
                      $.ajax({
                      type: "POST",
                      url: "./content/pdf-view-bill.php",
                      data: {
                         bills: '6',
                         copyrecipient:copyrecipient,
                         customhintcopy:customhintcopy,
                         additionaltextcopy: '',
                         copycoveringnotes: '5',
                         documentationcopy: '1',
                         original: '1'
                      }
                      success: function(data){
                          var win = window.open();
                          win.document.write(data);
                      }
                    })</script>

var copyrecipient=[];
var customhintcopy=[];
copyrecipient.push(“客户”);
copyrecipient.push(“健康保险”);
customhintcopy.push('4');
customhintcopy.push('6');
$.ajax({
类型:“POST”,
url:“./content/pdf view bill.php”,
数据:{
条例草案:‘6’,
copyrecipient:copyrecipient,
customhintcopy:customhintcopy,
其他文本副本:“”,
copycoveringnotes:'5',
文件副本:“1”,
原文:“1”
}
成功:功能(数据){
var win=window.open();
win.document.write(数据);
}
})
控制台在“成功行”上抛出“uncaughtsyntaxerror:Unexpected identifier”,我不知道为什么。 我想要的是打开一个新窗口或选项卡,该窗口或选项卡接收我上面定义的数据。
有人能帮我吗?我对Ajax非常陌生…

您错过了
数据对象的
}
上的逗号

data: {
    bills: '6',
    copyrecipient:copyrecipient,
    customhintcopy:customhintcopy,
    additionaltextcopy: '',
    copycoveringnotes: '5',
    documentationcopy: '1',
    original: '1'
}, // <-- Here
success: function(data){
    var win = window.open();
    win.document.write(data);
}
数据:{
条例草案:‘6’,
copyrecipient:copyrecipient,
customhintcopy:customhintcopy,
其他文本副本:“”,
copycoveringnotes:'5',
文件副本:“1”,
原文:“1”

},//还有很多错误。天哪,这件事太琐碎了。。。脸掌。谢谢!至少现在窗口打开了,但是提供的POST数据似乎有问题。。。接下来我需要修复这些…生成的页面应该是一个PDF文件。现在它是这样打开的:%PDF-1.4 3 0 obj/Contents 4 0 R>>endobj 4 0 obj stream x��Z�N��g} E��&v�{�2=�^���(E)`�E�|QL�^在里面�|�~�~C��s�W�#R�X���s��{���㑒N�:�^8/�,^�J�81�Q� ެ��广州