JQuery UI对话框不会弹出

时间:2011-03-18 14:58:01

标签: jquery dialog

我尝试构建一个Announcement弹出功能。目前,我有一个回调函数来检查是否有人修改了announcement.html。

所以这是代码

<div id="popupDialog" class="cs_AnnoucementPop">
    <?=$this->data['Popup']?>
    test
</div>

<script type="text/javascript">
setInterval("_checkUS2PopUpUpdate()", 12000); //12 seconds (debugging - change back to 50)
</script> 

所以,每隔12秒,就会有一次Ajax调用

function _checkUS2PopUpUpdate()
{
    var callback=new Object();
    callback.success=this.onExternalSuccess;
    callback.failure=this.onExternalFailure;
    YAHOO.util.Connect.asyncRequest('GET','/ci/ajaxCustom/ajaxUS2CheckPopupUpdate',callback);
};
function onExternalSuccess (o){
    if(o.responseText!==undefined)
    {
    var str=o.responseText;
    //document.getElementById('updateContent').innerHTML=str;
    if(str !== 'no update2') // Then pop up.
    {
        // This code is valid for jQuery-ui but it is not working. I think jQuery is being imported somewhere else and overwriting
        // jQuery-ui - I have set it back to the original popup for now - Matt Drewery
            $.noConflict();
        $.get('/euf/assets/announcements/pop_up_announcement_us2.html', function(data) {
                    $('#popupDialog').html(data);
                    $('#popupDialog').dialog({modal: true});
            });

            /*L=screen.width-200;
        T=screen.height;
        popup=window.open(str,"",'alwaysRaised=yes,status=no,toolbar=no,location=no,menubar=no,directories=no,resizable=no,scrollbars=no,height=200,width=330,left="+L+",top="+T');
        for (i=0;i<200;i++)
        {
        T=T-1;
        popup.moveTo(L,T);
        }*/
        }
    }

}

当有人发送公告时,它会调用加载HTML文件并尝试使用JQuery UI对话框弹出

然而,我遇到了休息错误。我不知道该怎么走。感谢。

$( [Break On This Error] $('#popupDialog').dialog({modal: true});

1 个答案:

答案 0 :(得分:1)

使用JQuery,你不能使用noConflict方法,以后再使用$ sign。请在http://api.jquery.com/jQuery.noConflict/

上查看相关文档

试试这个

$.noConflict();
jQuery.get('/euf/assets/announcements/pop_up_announcement_us2.html', function(data) {
 jQuery('#popupDialog').html(data);
 jQuery('#popupDialog').dialog({modal: true});
});
相关问题