-3
myClickHandler = function(e) {
       var ng = $('#num_groups').val();
       for (var group = 1; group <= ng; group++) {
         if (!validation(group)) return false;
       }
       if (confirm( "Are you sure you want to Proceed?" + "\n")) {
         $.ajax({
           url: "insertpenaltymarks.php",
           data: $("#PenaltyMarks").serialize(),
           async: false,
           type: "POST"
           success:function(result){
            $.ajax({
                 url: "sessioncomplete.php",
                 async: false,
                 type: "POST",
                 success:function(response){
                      window.location = "complete.php";
                  }
               });
        }
         });
         return true;
      } else {
        return false;
      }
    }

使用上面的代码,我试图发送 2 个 ajax 请求,一个去页面,insertpenaltymarks.php另一个去页面。但我收到一个我不太明白的错误:sessioncomplete.phpcomplete.php

Syntax error at line 57 while loading: expected '}', got 'success'
           success:function(res

这个错误实际上是什么意思,如何解决?

4

2 回答 2

4

"POST"在第一个 Ajax 调用之后设置逗号:

// ---------v
type: "POST",
success: function(result) {
于 2013-02-14T20:07:18.557 回答
0

后面需要一个逗号"POST"

于 2013-02-14T20:08:40.523 回答