0
上午j確認用戶確認。jConfirm警報 - 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 2010-12-07 06:29:09