我试图在成功的AJAX调用中进行AJAX调用。我查看了类似的线程,看看我是否正确地进行了操作,看起来就像我一样。
我错过了什么?我收到了意外的令牌错误'在第二个开头#.ajax({' line。
$.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); }
});
答案 0 :(得分:3)
你在第二次ajax电话前缺少一个$。这应该可以解决问题。
答案 1 :(得分: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); }
});