사용자 확인을 위해 j를 확인하십시오.알림 - jQuery 플러그인 확인
내 첫 번째 jConfirm은 사용자 작업을 위해 멈추지 않고 다음으로 넘어갑니다.
내 코드 :
$(function() {
$("#UpdateJobHandler").click(function() {
var JobHander = getJobHandler();
if (JobHander.MaxInstances == 0) {
jConfirm('Continue?', 'Current Maximum Instances', function (ans) {
if (!ans)
return;
});
}
var json = $.toJSON(JobHander);
$.ajax({
url: '../Metadata/JobHandlerUpdate',
type: 'POST',
dataType: 'json',
data: json,
contentType: 'application/json; charset=utf-8',
success: function (data) {
var message = data.Message;
var alertM = data.MessageType;
if (alertM == 'Error') {
$("#resultMessage").html(message);
}
if (alertM == 'Success') {
$("#resultMessage").empty();
alert(alertM + '-' + message);
action = "JobHandler";
controller = "MetaData";
loc = "../" + controller + "/" + action;
window.location = loc;
}
if (alertM == "Instances") {
jConfirm(message, 'Instances Confirmation?', function (answer) {
if (!answer)
return;
else {
var JobHandlerNew = getJobHandler();
JobHandlerNew.FinalUpdate = "Yes";
var json = $.toJSON(JobHandlerNew);
$.ajax({
url: '../Metadata/JobHandlerUpdate',
type: 'POST',
dataType: 'json',
data: json,
contentType: 'application/json; charset=utf-8',
success: function (data) {
var message = data.Message;
$("#resultMessage").empty();
alert(alertM + '-' + message);
action = "JobHandler";
controller = "MetaData";
loc = "../" + controller + "/" + action;
window.location = loc;
}
});
}
});
}
}
});
});
});
내가 무엇을 놓치고? 이 모든 경우
감사합니다. icyrock, 더 작은 함수로 분할하여 이것을 다시 고려해 볼 수 있습니까? – Sreedhar
@Nev_Rahd 편집을 참조하십시오. –