在某些情况下未定义响应对象

时间:2019-02-27 09:27:04

标签: javascript ajax frontend yui

我正在修复此代码中的错误。在某些情况下responseObj为空,表示

  

responseObj未定义

此应用程序的后端是用perl编写的。谁能提供解决方案或任何建议?

function handleGiveUp(part) {
  if (!confirm("Are you sure you want to request the answer to this question? If you do, you will not get any credit for it.")) {
    return;
  }

  var ioArgs = {
    action: 'showAnswer',
    assignmentProblemID: part.parent.config.assignmentProblemID,
    partID: part.id,
    noErrorAlertOnSuccess: true,
    aCSRFToken: MxData.aCSRFToken
  };

  shieldedSubmitServerCall(part, ioArgs, {
    onSuccess: function(responseObj) {
      processShowAnswer(part, responseObj.data);
    }
    function handleGiveUp(part) {
      if (!confirm("Are you sure you want to request the answer to this question? If you do, you will not get any credit for it.")) {
        return;
      }

      var ioArgs = {
        action: 'showAnswer',
        assignmentProblemID: part.parent.config.assignmentProblemID,
        partID: part.id,
        noErrorAlertOnSuccess: true,
        aCSRFToken: MxData.aCSRFToken
      };

      shieldedSubmitServerCall(part, ioArgs, {
        onSuccess: function(responseObj) {
          processShowAnswer(part, responseObj.data);
        }
      });
    }
  });
}

0 个答案:

没有答案
相关问题