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.php
和complete.php
页面。但我收到的错误我真的不太明白:
Syntax error at line 57 while loading: expected '}', got 'success'
success:function(res
这个错误究竟意味着什么,以及如何修复?
答案 0 :(得分:4)
在第一个Ajax调用中的"POST"
之后设置逗号:
// ---------v
type: "POST",
success: function(result) {
答案 1 :(得分:0)
"POST"
后需要逗号。