在PHP中回显jQuery警报弹出窗口 [英] echoing a jquery alert popup in php

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

问题描述

我想在满足PHP中的某些条件时显示一个弹出警报框.像这样:

I want to display a pop-up alert box upon some condition in PHP being satisfied. Something like:

  echo "<script type="text/javascript"> alert('bleh'); </script>";

使用自定义jquery警报框除外.这可能吗?

except using a custom jquery alert box. Is this possible??

我尝试过类似的事情:

  echo "<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
   <link rel="stylesheet" href="/resources/demos/style.css" />
   <script>
   $(function() {
   $( "#dialog-message" ).dialog({
   modal: true,
   buttons: {
    Ok: function() {
      $( this ).dialog( "close" );
    }
  }
  });
});
</script>"; 

但是它给了我一个怪异的效果.没有弹出.

but it gives me a weird effect. Not pop up.

感谢您的关注.

推荐答案

echo <<<EOD
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <script>
       $("#dialog-message").dialog({
           modal: true,
           buttons: {
               Ok: function() {
                  $( this ).dialog( "close" );
               }
           }
       });
    </script>
EOD;

这篇关于在PHP中回显jQuery警报弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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