[英]load ajax url on new page?
i know this question is not asked well & iam sorry for that
我知道这个问题问得不好,对此我很抱歉
given requirement is that url shoul be open in _blank page but i have design ajax url is it possible ajax url is open in new page?给定的要求是 url 应该在 _blank 页面中打开,但我有设计 ajax url 是否有可能在新页面中打开 ajax url? like regular url other wise i have to change lots of things here is the code
像常规网址一样,否则我必须更改很多东西,这是代码
function pdfPrint(start_date , end_date , view){
var startDate = $('#setDate-'+start_date).val();
var endDate = $('#setDate-'+end_date).val();
data = {
"startDate":startDate,
"endDate":endDate,
"view":view,
"systemid":system_id,
};
$.ajax({
url: "{{route('download.pdf')}}",
type: "get",
'headers': {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
data:data,
}).done(downloadFile);
}
this simple trick to open window and exec js code;这个打开窗口和执行js代码的简单技巧;
let js = `<script>
function pdfPrint() {
window.print();
}
// exec your function
pdfPrint();</` + `script>`;
let win = window.open("", "MsgWindow", "width=400,height=400");
win.document.write(js);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.