2016-12-14 53 views
-1

我想在一個成功的AJAX調用內做一個AJAX調用。我看着類似的線程,看看我是否做得正確,看起來像我。在AJAX AJAX導致意外的令牌錯誤

我缺少什麼?我在第二個「阿賈克斯({」線的起點得到一個「意外的標記錯誤」。

$.ajax({ 
      type: "POST", 
      url: "actionPages/billing.php", 
      data: { 
       custID: custID, 
       credFName: credFName, 
       credLName: credLName, 
       credNum: credNum, 
       credExpireMonth: credExpireMonth, 
       credCVVNum: credCVVNum, 
       credAddress: credAddress, 
       credStreet: credStreet, 
       credCity: credCity, 
       credProvinState: credProvinState, 
       credCountry: credCountry, 
       credPostalZip: credPostalZip, 
       credExpireYear: credExpireYear, 
       dealID: dealID 
      }, 
      dataType: 'json', 
      success: function(response) { 

       var credID = response; 

       .ajax({ 
        type: "POST", 
        url: "actionPages/order.php", 
        data: { 
         credID: credID, 
         custID: custID, 
         dealID: dealID 
        }, 
        dataType: 'json', 
        success: function(response) { 

        }, 
        error: function (e) { console.log(e); } 
       }); 
      }, 
      error: function (e) { console.log(e); } 
     }); 

回答

3

你缺少第二Ajax調用前面的$,這應該做的伎倆。

+0

哇,真是尷尬!謝謝seb – Calisto

0
write $.ajax in inner ajax code  
$.ajax({ 
     type: "POST", 
     url: "actionPages/billing.php", 
     data: { 
      custID: custID, 
      credFName: credFName, 
      credLName: credLName, 
      credNum: credNum, 
      credExpireMonth: credExpireMonth, 
      credCVVNum: credCVVNum, 
      credAddress: credAddress, 
      credStreet: credStreet, 
      credCity: credCity, 
      credProvinState: credProvinState, 
      credCountry: credCountry, 
      credPostalZip: credPostalZip, 
      credExpireYear: credExpireYear, 
      dealID: dealID 
     }, 
     dataType: 'json', 
     success: function(response) { 

      var credID = response; 

      $.ajax({ 
       type: "POST", 
       url: "actionPages/order.php", 
       data: { 
        credID: credID, 
        custID: custID, 
        dealID: dealID 
       }, 
       dataType: 'json', 
       success: function(response) { 

       }, 
       error: function (e) { console.log(e); } 
      }); 
     }, 
     error: function (e) { console.log(e); } 
    });