开发者

JQuery ModalDialog only shows data once and not on repeat attempts

We have a image that calls a script function that should show a jquery modal dialog popup. The dialog loads once with the data and then when we close it and try to click on the img again it does not load the data, sometimes the dialog will appear but be blank. If we take the link from the img tag and put it in a new browser it pulls the data fine so the link should be ok.

Below is the script in the head section of the page:

function ShowReportDialog(reportur开发者_如何转开发l){
jQuery("#reportdialog").dialog({
         title: 'Hello World',
          modal: true,
         width: 915,
         height: 670}).show();
jQuery("#reportdialog").load(reporturl);
}

Image Tag that calls the script:

<img style="border:0;" onclick="ShowReportDialog('Service/REPORT?ARCHIVE=102127');" src="/Images/rerun.png"

Anyone see anything I missed or a better way?

Thanks


jQuery is probably caching your AJAX request. Check out this other thread for ways to prevent this from happening.

Edit: I'm by no means a jQuery expert, but I believe you should only show your dialog after the AJAX request has been responded. So I'm guessing something like this:

function ShowReportDialog(reporturl){
    jQuery("#reportdialog").load(reporturl, function(){
        jQuery("#reportdialog").dialog({
            title: 'Hello World',
            modal: true,
            width: 915,
            height: 670
        }).show();
    });
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜