我想在另一个ajax成功响应中调用jquery ajax.'request-status'响应正确返回并且'.table-responsive'div重新加载我除外。但是当我试图调用'welcome-mail时成功响应'我抓住了Uncaught SyntaxError: Unexpected token )
。我尝试了
$.ajax({
url: 'request-status',
type: 'GET',
data: {'id':user_id,'status':status,'comment':comment},
dataType: 'JSON',
success: function(data, textStatus, jqXHR){
//alert(data);
$(".table-responsive").load(location.href + " .table-responsive");
$.ajax({
type: "GET",
url: "welcome-mail",
data: {'id':user_id},
dataType: 'JSON',
success: function(data, textStatus, jqXHR){
alert(data);
}
});
},
error: function(jqXHR, textStatus, errorThrown){
// alert('errror');
},
});
Route
Route::get('welcome-mail','travelerHome@welcomeMail');
controller
public function welcomeMail(Request $request)
{
$request_data = $request->all();
$id = $request_data['id'];
return response()->json();
}
答案 0 :(得分:1)
成功后您缺少一个括号,但有额外的});不属于那里 - 它应该是:
success: function(data, textStatus, jqXHR){
alert(data);
}
});