jquery 플러그인의 기존 함수에 콜백을 추가하려고합니다. https://github.com/premasagar/nitelite - 콜백에 ajax가 없으면 콜백은 http://jsfiddle.net/HPc4e/2/으로 작동합니다. 가까운 기능의아약스가 포함 된 콜백 실패
해당 섹션 :
// Blah blah ...
else {
showFlash();
this.overlay.remove();
this.container
.empty()
.remove();
$(this).triggerHandler('close');
// Add callback
if (typeof callback == "function") {
callback();
}
}
return this;
콜백 :
lb.close(undefined, 'click', function() {
$.ajax({
type: 'POST',
url: url,
data: {submit: $(this).val()},
dataType: 'json',
success: function(data) {
lightbox('Lightbox 2', '<p>Oh hi</p>', 'lightbox2');
}
});
});
감사
동작을 보여주는 데모 (jsfiddle.net?)를 사용할 수 있습니까? .empty 및 .remove는 DOM이 업데이트 될 때까지 반환되지 않아야합니다. – Alnitak
물론 몇 분만 기다려주세요! –
오, 쓰레기 내 작품을 작동합니다 :/http://jsfiddle.net/HPc4e/2/ –