我有一个页面包含一个链接,用于进行ajax调用以填充对话框。当我第一次运行代码时,它可以工作,当我第二次运行代码时,没有任何内容被填充。在将用作ajax调用的参数的数字放入变量并在其中使用调试器语句之后,我立即运行了一个brekpoint,它每次都运行正确。
<script src="Scripts/MyAuditsLoad.js" type="text/javascript"></script>
<script src="Scripts/json2.js" type="text/javascript"></script>
<script src="Scripts/jquery.blockUI.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);
$(document).ready(function () {
$("a.index").on("click", function (e) {
e.preventDefault();
// debugger;
UserIndexNumber = $(e.target).text();
debugger;
editAuditDialogOpen();
});
}
//**********End Add Manual Audit Dialog *************
function editAuditDialogOpen() {
$("#EditAuditDialog").load("EditAuditDialog.aspx").dialog({
autoOpen: false,
title: "Edit Audit Result",
modal: true,
draggable: false,
resizable: false,
width: 850,
height: 700,
show: { effect: 'blind',
duration: 100
},
buttons: {
'Update': function () {
//$("#EditAuditDialogForm").trigger("reset");
$(this).dialog('destroy').remove();
$('#form12').append('<div id="EditAuditDialog"></div>');
//$(this).dialog("close");
},
'Cancel': function () {
//$("#EditAuditDialogForm").trigger("reset");
$(this).dialog("close");
}
}
});
$("#EditIndexNumber").val(UserIndexNumber);
$("#EditAuditDialog").dialog("open");
//*********Fill Claim Fields************
//debugger;
var param = {};
param.IndexNumber = parseInt(UserIndexNumber);
//debugger;
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(param),
url: "QAWebService.asmx/GetEditAuditDetails",
dataType: "json",
success: ajaxSucceessAuditDetails
});
function ajaxSucceessAuditDetails(data) {
$('#EditAuditAuditProgram').change();
$('#EditAuditAuditProgram').val(data.d.Details.AuditProgramID);
var editFirstChange = 0;
var editCount = 0;
$('#EditAuditAuditProgram').on("change",function () {
//*********Change Claim Type Fields************
ClaimTypeTransactionTypeID = data.d.Details.ClaimTypeTransTypeID;
AuditTypeID = data.d.Details.AuditTypeID;
TeamID = data.d.Details.TeamID;
AuditProgramID = data.d.Details.AuditProgramID;
var param = {};
param.AuditProgramID = data.d.Details.AuditProgramID;
var program = AuditProgramID;
var referenceNumberType;
$('#EditAuditTeam').val(TeamID);
}
$('#EditAuditType').val(AuditTypeID);
}
// // //*********Populate Claim Type/Transaction Type Dropdown and Change Label************
});
$("#EditAuditAuditProgram").val(data.d.Details.AuditProgramID);
$("#EditIndexNumber").append(data.d.Details.IndexNumber);
$("#EditOpNumber").val(data.d.Details.OperatorID);
$("#EditBilledAmount").val(data.d.Details.AmountBilled);
$("#EditTotalPaid").val(data.d.Details.TotalPaid);
$("#EditCorrectPayment").val(data.d.Details.CorrectPayment);
$("#EditAuditNotes").val(data.d.Details.AuditNote);
$("#EditReferenceNumber").append(data.d.Details.ReferenceNumber);
$("#EditOriginalAuditor").append(data.d.Details.OriginalAuditorName);
$("#EditAuditDate").append(data.d.Details.OriginalAuditDate);
Attributes = data.d.Details.AuditAttributes;
var param = {};
param.auditProgramID = data.d.Details.AuditProgramID;
param.ClaimTypeTransTypeId = data.d.Details.ClaimTypeTransactionTypeID;
}
//*********End Claim Fields************
};
}); var UserIndexNumber;
答案 0 :(得分:0)
.load()进行AJAX调用,这是异步。您需要在回调函数上创建对话框。
$("#AddManualAuditDialog").load("AddManualAuditDialog.aspx", function() {
$(this).dialog( { ... } )
})