繁体   English   中英

基于ajax响应打开jquery-ui对话框

[英]open jquery-ui dialog based on ajax response

当checklatestnews.php的响应满足条件rec!=“ 0”时,我试图打开一个jQuery-ui对话框。 我创建了一个测试checklatestnews.php文件,其中的响应始终为“ 1”,但是仍然无法打开jquery-ui对话框。 任何帮助,将不胜感激。

<div id="dialog">

<script type="text/javascript">

 $("#dialog").dialog(
   {
    bgiframe: true,
    autoOpen: false,
    height: 100,
    modal: true
   }
);
</script>

<script type="text/javascript">

   var check_latestnews;
function CheckForLatestNewsNow() {
    var str="chklatestnews=true";
    jQuery.ajax({
            type: "POST",
            url: "checklatestnews.php",
            data: str,
            cache: false,
            success: function(res){
                if(res != "0") {


 $("#dialog").html(response).dialog("open");

                }

            }
    });
}
check_latestnews = setInterval(CheckForLatestNewsNow, 5000);
</script>
$.post("checklatesnews.php", {action: "check"}, function(response) {
    .....
    $("#dialog").dialog("open");
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM