动态表单Post无法在mozilla中工作

Dynamic form Post not working in mozilla

本文关键字:mozilla 工作 表单 Post 动态      更新时间:2023-09-26

这是我动态生成的表单。下载pdf。它在google chrome中运行良好。但在firefox中未命中服务。


 $scope.downloadSettledReport = function () {
                var template = "  <html> <head> <style> div{font-size: 10px;}table, .center{margin: auto; width: 60%; padding: 10px;}</style> </head> <body class='center'> <table> <tr> <td>" + $scope.downloadContent[0].outerHTML + "</td></tr></table> </body></html>";
                var element = $('<form/>');
                element.html('<input type="text" name="fileHtml" value="' + encodeURI(template) + '"/>   <input type="text" name="fileName" value="SettlementREport.pdf"/>');
                element.attr({ method: 'POST', action: UtilitiesService.getUrlPrefix() + "/hosp/file/getPdf" }).submit();              
            }

我刚刚将html模板附加到body中,它就开始工作了。

 $scope.downloadSettledReport = function () {
            var template = "  <html> <head> <style> div{font-size: 10px;}table, .center{margin: auto; width: 60%; padding: 10px;}</style> </head> <body class='center'> <table> <tr> <td>" + $scope.downloadContent[0].outerHTML + "</td></tr></table> </body></html>";
            var element = $('<form/>');
            element.html('<input type="text" name="fileHtml" value="' + encodeURI(template) + '"/>   <input type="text" name="fileName" value="SettlementREport.pdf"/>');
            element.attr({ method: 'POST', action: "action: UtilitiesService.getUrlPrefix() + "/hosp/file/getPdf"" });
            $(document.body).append(element);
            element.submit();
        }