在html页面上,我有一个超链接(id =' WhatsNew'),在点击时会显示一个html页面作为poup,使用以下jquery代码:
$jQ(document).ready(function(){
var pars="WhatsNew=Y";
$jQ.post("/Bids/whatsnew",pars,function(result){
if(result=="no"){
return false;
}else{
var bsdPFA= BootstrapDialog.show({
title:'What\'s New?',
message:result, nl2br:false,
draggable:true,
buttons:[{label:'Close', id: 'wn_close',
action:function(dialogRef){
dialogRef.close();
}
}]
});
bsdPFA.$modal.find('.modal-dialog').css({'width':'60%','height':'auto'});
}
});
在另一个文件中,我有一个处理点击的jquery代码:
if ($('WhatsNew')) {
Event.observe('WhatsNew', 'click', function(){
var myAjax = new Ajax.Request('/bids/whatsnew/', {method: 'post', onComplete:showDropBox});
//window.open("/bids/whatsnew/", 'Help', "height=300,width=600,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes", true);
//window.open("/bids/whatsnew/","mywindow","scrollbars=1,width="+screen.availWidth.toString()+",height="+screen.availHeight.toString());
});
}
我的代码' showDropBox'功能:
var user_data = response.responseText.split('::');
var email = user_data[0];
var name = user_data[1];
if (typeof(Zenbox) !== "undefined") {
Zenbox.init({
//dropboxID: "20015556",
dropboxID: "20020983",
url: "https://hotelrfp.zendesk.com",
tabID: "support",
tabColor: "black",
tabPosition: "Left",
hide_tab: true,
requester_name: name,
requester_email: email
});
每当我点击超链接时,弹出窗口会持续很短的时间(几乎半秒)并关闭。请帮我解决这个问题。