JQuery UI dialog does not pop up
I try to build an Announcement pop up function. Currently, i have a call back function to check whether someone modify the announcement.html.
So here is the code
<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>
So, every 12 seconds, there will an Ajax call
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/announce开发者_开发百科ments/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);
}*/
}
}
}
When someone send an announcement, it calls to load the HTML file and try to pop up by using JQuery UI dialog
However, I got a break error. I do not know how to go further. Thanks.
$(
[Break On This Error] $('#popupDialog').dialog({modal: true});
With JQuery you can not use the noConflict method and later use the $ sign. Check the docs for this on http://api.jquery.com/jQuery.noConflict/
Try this
$.noConflict();
jQuery.get('/euf/assets/announcements/pop_up_announcement_us2.html', function(data) {
jQuery('#popupDialog').html(data);
jQuery('#popupDialog').dialog({modal: true});
});
精彩评论