Ajax中的jQuery弹出窗口
我正在使用jQuery和。单击超链接时,要在弹出菜单中加载的关联文档工作正常。当我使用Ajax时,问题就来了 我的代码 策略:看到超链接后,需要在弹出窗口中显示相关内容 Load.htmlAjax中的jQuery弹出窗口,jquery,ajax,popup,Jquery,Ajax,Popup,我正在使用jQuery和。单击超链接时,要在弹出菜单中加载的关联文档工作正常。当我使用Ajax时,问题就来了 我的代码 策略:看到超链接后,需要在弹出窗口中显示相关内容 Load.html 由于Load.html在index.html中动态加载,所有标记 与PDF文件的链接相关联,load.html文件将不会 在弹出窗口中显示文档。如何更改代码 要执行上述输出?我认为您遇到的问题是,您没有等待load.html的内容通过ajax完成加载。您需要为该调用设置回调,以便正确使用其内容 这样做:
由于Load.html
在index.html
中动态加载,所有标记
与PDF文件的链接相关联,load.html
文件将不会
在弹出窗口中显示文档。如何更改代码
要执行上述输出?我认为您遇到的问题是,您没有等待
load.html
的内容通过ajax完成加载。您需要为该调用设置回调,以便正确使用其内容
这样做:
//index.html
....
jQuery.ajax({
type:'POST',
url:' my.php',
data:'one='+one,
success: function(data){
jQuery("#another").load("load.html", function() {
//pop up code for the Load.html
jQuery("a[rel='pop']").click(function (e) {
e.preventDefault();
var features = "height=700,width=800,scrollTo,resizable=1,scrollbars=1,location=0";
newwindow=window.open(this.href, 'Popup', features);
return false;
});//click
}//load
});//success
});//ajax
据我所知,这应该能解决你的问题
<a href="pdf/file1.pdf" id="pop" rel="pop"> click 1.</a>
<a href="pdf/file2.pdf" rel="pop">click2</a>
//index.html
....
jQuery.ajax({
type:'POST',
url:' my.php',
data:'one='+one,
success: function(data){
jQuery("#another").load("load.html", function() {
//pop up code for the Load.html
jQuery("a[rel='pop']").click(function (e) {
e.preventDefault();
var features = "height=700,width=800,scrollTo,resizable=1,scrollbars=1,location=0";
newwindow=window.open(this.href, 'Popup', features);
return false;
});//click
}//load
});//success
});//ajax