English 中文(简体)
持有 but子的AJCAR的开放式人民力量档案
原标题:Open PDF file by AJAX holding the button

你们能否帮助我解决下列问题?

我的表格是你选择产生一份PDF报告的参数,由浏览器开启的Stuts 1.x行动予以退回。 该系统的工作非常同步。

但是,我需要保护系统不受用户的影响的是,要求报告时没有做过所有的时间,因此,只有在报告产生后,才使纽伦上锁。

My choice was to create a function in AJAX (asynchronous call) to which this report was generated, and while this process does not answer me back I hide the button and show the "loading" and so has the return button I show and hide the "loading".

但我在两个不同的审判中存在问题:

在第一次尝试(第1条)中,预计纽伦的杂货行为和装货将发生,但我的PDF文件指出,在浏览器下载窗口中,以下功能(数据)不会打开:

...
success: function (data) {
    WinID var = window.open (  ,  newwin ,  width = 400, height = 500 );
    WinId.document.open ();
    WinId.document.write (data);
    WinId.document.close ();
...

在使用Dojo的第二次审判(第2条)上,预计会归还PDF文档,但当浏览器下载窗口时,会失去控制,使纽芬兰再次出现无法置信的形象。

是否有办法利用 j或Dojo控制我的DIVs来打开国防军的档案?

感谢您,

传真 分散:

...
<tr>
    <td colspan="3" align="center" valign="middle">
        <div id="button">
            <a href="javascript:execute();"> 
                <img src="images/btnExecute.png" alt="Execute" border="0" class="inputImage" /> 
            </a>
        </div>
        <div id="loadingImage">
            <img src= images/loading.gif  style="{align:right;}" />
        </div>
    </td>
</tr>
...

第1号法律:

function execute()
{
    $.ajax({
        type:"GET",
        url: "generateReport.do",
        data: "action=print&param1=param1",
        dataType: "html",
        beforeSend : function() {
            //It works
            $( #button ).hide();
            $( #loadingImage ).show();
        },
        complete : function() {
            $( #button ).show();
            $( #loadingImage ).hide();
        },
        success : function(data) {
            var WinId = window.open(  ,  newwin ,  width=400,height=500 );
            WinId.document.open();
            WinId.document.write(data);
            WinId.document.close(); 
        }
    }); 
}

《刑法》第2条:

function execute()
{   
    //It works
    $( #button ).hide();
    $( #loadingImage ).show();

    var url = "generateReport.do?action=print&param1=param1";             

    require(["dojo/io/iframe"], function(ioIframe){
        ioIframe.send({
            url: url,
            handleAs: "html"
        }).then(function(data){
            //It only works when my page returns the html message "Empty report"
            $( #button ).show();
            $( #loadingImage ).hide();
        }, function(err){
        });
    }); 
}
问题回答

http://strong>cannot。 你们的报告是什么。 确实是返回的,即怀疑其扣押。

你们需要做的是: 报告。 确实是一份载有pdf内容的临时档案,然后归还URL。 一旦有了URL,就将其放在你窗户的位置上。

  1. call generateReport.do
  2. function(data) holds "http://mydomain.tld/cached_contents/234kj82341.pdf" in data
  3. function(data) calls window.open(data, window_open_parameters);

这将使浏览器要么为人民抵抗力量的原始产品服务,要么 view。 我们不能通过javascript /dom这样做。

或者,在您的窗口中找到一种闪电 p或相似之处,文件.write, 放下了<条码>与;object src=“my_pdf_plugin”......></object>

function execute()
{   
    // this is Not dojo, it looks like jQuery, see below onload function
    $( #button ).hide();
    $( #loadingImage ).show();

    var url = "generateReport.do?action=print&param1=param1";             

    require(["dojo/io/iframe"], function(ioIframe){
        ioIframe.send({
            url: url,

see handleAs: http://dojotoolkit.org/reference-guide/1.7/dojo/io/iframe.html in your testcase (with handleAs:html), if returned data is not of content-type text/html it will be discarded - after trying to convert text/plain into an actual html-document

            handleAs: "text"
        }).then(function(data){
            //It only works when my page returns the html message "Empty report"
            $( #button ).show();
            $( #loadingImage ).hide();
        }, function(err){
        });
    }); 
}

dojo.addOnLoad(function() {

// this will create a disabled dojo button
require(["dijit/form/Button"], function(dijitButton) {
  var domNode = dojo.byId( button );
  var btn = new dijitButton({
     diabled: true,
     id:  PDFBUTTON ,
     label: domNode.innerHTML // default behavior even so, for show here
  }, domNode);

  // showcase:
  var enabled = true;
  dijit.byId( PDFBUTTON ).set("disabled", !enabled);

});

}




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签