function openFiles(fileSlNo){
var data = {
pageMode: "PDF_DISPLAY",
fileSlno: fileSlNo
};
var d = $.param(data);
var request = $
.ajax({
type: "GET",
url:"folderNavigation.do?"+d,
dataType : "TEXT",
success: function(responseData){
//response Data is a URL that returns a strem
var document=encodeURIComponent(responseData);
//document is a variable that encodes the URL coming.
$("#showDialog").html('<iframe src="web/viewer.html?file='+document+'" width="900px" height="650px"></iframe>')
.dialog({
create: function(event, ui) {
$("body").css({ overflow: 'hidden' });
},
closeOnEscape: function(event, ui) {
$("body").css({ overflow: 'inherit' });
},
height:'auto',
width:'auto',
modal: true,
resizable: false,
draggable:false,
position:["center",30],
closeOnEscape: true,
});
},
error: function (jqXHR, textStatus, errorThrown) {
alert("jqXHR: " + jqXHR.status + "\ntextStatus: " + textStatus + "\nerrorThrown: " + errorThrown);
}
});
}
<div id="showDialog" title="Document Viewer"style="display: none;"></div>
答案 0 :(得分:0)
获得网址后,使用jquery更改现有src
的{{1}}:
iframe
P.S。:我建议您不要声明名为$('#targetiframe').attr('src', url);
的变量。