动态表单发布不在mozilla中工作

时间:2015-12-08 06:20:14

标签: javascript forms firefox html-form-post

这是我动态生成的表格。要下载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();              
            }

1 个答案:

答案 0 :(得分:0)

我只是将html模板附加到正文并开始工作。

 $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();

        }