我进行了很多搜索,并尝试了很多方法,但都没有找到解决方案,在我的代码中,当我单击下载时,该文件就会显示已归档
我的角度代码是
$scope.downloadList = function () {
Factory.downloadSubmissions($scope.Id, $scope.downloadType).then(function (response) {
var url = cf7_magick_object.ajax_url;
var link=document.createElement('a');
link.href=window.URL = url+"submission.pdf";
link.download= response.data;
link.click();
});
};
我的ajax回调PHP函数是
public function downloadFormSubmissionCallback(){
$formPostId = (int)$_REQUEST['formId'];
$downloadType = $_REQUEST['downloadType'];
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
$output = $dompdf->output();
echo json_encode($output);
}
谁能告诉我我哪里错了?