0

我有一页包含一个链接,该链接用于进行 ajax 调用以填充对话框。当我第一次运行代码时,它可以工作,当我第二次运行它时,什么都没有填充。我在将用作 ajax 调用参数的数字放入变量后立即放置了一个断点,并在其中使用调试器语句,它每次都运行正确。

<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 用户索引号;

4

1 回答 1

0

.load() 进行 AJAX 调用,所以它是异步的。您需要在回调函数上创建对话框。

 $("#AddManualAuditDialog").load("AddManualAuditDialog.aspx", function() {
   $(this).dialog( { ... } )
 })
于 2013-11-05T00:09:47.687 回答