jQuery/JS:fancybox 从 ajax 调用加载
现在,当你制作一个 fancybox 时,你初始化一个链接并进行一些设置:
$("a#a_sendMail").fancybox({
'titleShow' : false,
'width': 400,
'height': 120,
'autoDimensions': false,
'overlayOpacity': 0.6
});
然后你用 id a_sendMail 进行链接,然后 href="#sendMail" 然后你为其制作 div:
<div style="display: none">
<div id="newMail">
This is inside the fancybox :)
</div>
</div>
现在,我想改为在保存内容的同一文件中创建一个 div 时,我想调用 newMail.php,其输出应显示为一个框。因此,当您单击链接(为了打开该框)时,它会发出 ajax 请求并返回/响应其中将显示的内容。
我怎样才能以最聪明、最简单的方式做到这一点?
Right now when you make a fancybox you initialize a link and give some settings:
$("a#a_sendMail").fancybox({
'titleShow' : false,
'width': 400,
'height': 120,
'autoDimensions': false,
'overlayOpacity': 0.6
});
and then you do the link with id a_sendMail, and then href="#sendMail" and then you make the div for it:
<div style="display: none">
<div id="newMail">
This is inside the fancybox :)
</div>
</div>
Now, I would like to instead of making a div in the same file that holds the content, I would like to call newMail.php, and the output of this should be shown as a box. So when you click the link(in order to open the box), it makes a ajax request and return/response with the content that are going to show inside it.
How can I do this the most smartest and simple way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 href 选项添加到 fancybox,如下所示:
您可以在此处查看所有选项: http://fancybox.net/ API
You can add the href option to fancybox, like this:
You can view all the options right here: http://fancybox.net/api