PHP生成的Fancybox弹出窗口中的消息 [英] Message in Fancybox popup generated by PHP

查看:58
本文介绍了PHP生成的Fancybox弹出窗口中的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现相当简单的事情,但是我无法弄清楚该怎么做. 我需要有一条消息,由PHP生成后,该消息会在jQuery Fancybox窗口中弹出.

I would like to achieve rather simple thing I guess but I'm unable to figure out how to do it. I need to have a message that pops out in a jQuery Fancybox window after being generated by PHP.

显示消息的代码可能很简单:

The code that would show the message could be that simple:

if(something){
    echo 'message sent!';
}

在这种情况下,我希望发送消息!"文本显示在Fancybox窗口中.

In this case I would want the "Message sent!" text to appear in Fancybox window.

任何帮助将不胜感激

推荐答案

假定您正在使用fancybox v2.x,并且已在php文档中正确初始化了jQuery和fancybox文件,我将这样做:

Assuming that you are using fancybox v2.x and that you have properly initialized jQuery and fancybox files in your php document, I would do:

<?php        
    if(something) { 
      $message = "message sent!";
?>

<script>
    $(document).ready(function() {
        $.fancybox("<?php echo $message; ?>",{
            minWidth: 'auto',
            minHeight: 'auto'
        }); // fancybox
    }); // ready
</script>

<?php 
    }; // close php if
?>

这篇关于PHP生成的Fancybox弹出窗口中的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆