안녕하세요 저는 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
어떤 도움을 기꺼이받을 것이다 :
내가했던 모든 여기에서 찾을 수있는 모범을 따를 것입니다.
감사합니다.
슬프게이다. –
작업 데모로 업데이트하십시오. – Dutchie432