这是通过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>
控制台在“成功行”上引发“未捕获的SyntaxError:意外的标识符”,我不知道为什么。 我想要的是要打开的新窗口或选项卡,该窗口或选项卡将发送我上面定义的数据。 有人可以帮助我吗?我是Ajax的新手...
答案 0 :(得分:-1)
您错过了}
对象的data
上的逗号。
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);
}