zoukankan      html  css  js  c++  java
  • ICallbackEventHandler不支持二次回调的问题

    今天用到了二次回调,即在回调函数中再次提交一个回调,事实上也调用成功,所要得效果也达到了
    但最后出现一个错

    错误: '__pendingCallbacks[...].async' 为空或不是对象

    跟下去发现问题出现在

    function WebForm_CallbackComplete() {
        for (var i = 0; i < __pendingCallbacks.length; i++) {
            callbackObject = __pendingCallbacks[i];
            if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {
                WebForm_ExecuteCallback(callbackObject);
                if (!__pendingCallbacks[i].async) {   '__pendingCallbacks[...].async' 为空或不是对象
                    __synchronousCallBackIndex = -1;
                }
                __pendingCallbacks[i] = null;
                var callbackFrameID = "__CALLBACKFRAME" + i;
                var xmlRequestFrame = document.getElementById(callbackFrameID);
                if (xmlRequestFrame) {
                    xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
                }
            }
        }
    }

    猜想大概是第一次回调使__pendingCallbacks[i] = null;造成

    最后使用setTimeout来解决这个问题,第一个回调函数中使用setTimeout来调用一个方法来进行另外的调用

  • 相关阅读:
    bzoj 4012: [HNOI2015]开店
    POJ 1054 The Troublesome Frog
    POJ 3171 Cleaning Shifts
    POJ 3411 Paid Roads
    POJ 3045 Cow Acrobats
    POJ 1742 Coins
    POJ 3181 Dollar Dayz
    POJ 3040 Allowance
    POJ 3666 Making the Grade
    洛谷 P3657 [USACO17FEB]Why Did the Cow Cross the Road II P
  • 原文地址:https://www.cnblogs.com/yashen/p/1420346.html
Copyright © 2011-2022 走看看