1
您好我有一个问题,当我的脚本完成处理时使用jquery覆盖失败关闭。jquery覆盖不会关闭
我所做的只是显示一个非常简单的表单,将提交的值在后台处理并添加到页面中。一旦完成,覆盖图应该关闭,但是它只是停留在那里,并且直到我进行整页刷新时才会去。
我的jQuery代码看起来是这样的:
function employmenthistory(){
$(document).ready(function(){
/**
* Modal Dialog Boxes Setup
*/
var triggers = $(".modalInput").overlay({
// some mask tweaks suitable for modal dialogs
mask: {
color: '#ebecff',
loadSpeed: 200,
opacity: 0.7
},
closeOnClick: false
});
/* User Input Prompt Modal Box */
$("#employmentprompt form").submit(function(e) {
// get user input
var name = $("#name", this).val();
var role = $('#role', this).val();
var title = $("#title", this).val();
//we need to know how many elements already exist
var elementCount = $('li.note').length;
//update server with information about this employment
$.ajax({
url: '/addempl/',
type : 'post',
data : "name=" + name + "&role=" + role + "&title=" + title + "&ec=" + elementCount,
dataType: "json",
success : function(msg){
//confirm the event was successful
if(msg.status == 'success'){
var item = msg.data;
//we now add to the ul for elements
$('ul.listing').append(item);
}else{
//failed to process so display error
$('div.message error').html('<p>We were unable to add your employment history</p><p>Please try again</p>');
}
},
error : function(err){
//failed to call server
$('div.message error').html('<p>We were unable to add your employment history</p><p>Please try again</p>');
}
});
// close the overlay
triggers.eq(0).overlay().close();
// do not submit the form
return e.preventDefault();
});
});
}
这段代码的所有方面工作天晴,当我到达
triggers.eq(0).overlay().close();
与形式覆盖在它仍然在页面上。只有一个modelInput元素和窗体可以调用,所以我不知道为什么这是失败的。
所有我所做的就是按照这可以在这里找到了例子:
http://flowplayer.org/tools/demos/overlay/modal-dialog.html
任何帮助,这将受到欢迎。
谢谢。
黯然。 – 2011-05-04 20:52:16
请参阅我的更新与工作演示。 – Dutchie432 2011-05-05 12:52:52