我想像这样将发件人 id 传递给 laravel 路由,但似乎我的代码不起作用。请指定正确的方法。
url: '/agent_close/{sender_id}',
function closeChat(){
sender = document.getElementById("sender_id").value;
$.ajax({
type: "POST",
url: '/agent_close/{sender_id}',
data: "sender_id=" + sender,
success: function (data) {
console.log('Message Closed');
console.log(data);
},
error: function (data) {
console.log('An error occurred');
console.log(data);
},
});
}
路线是:
Route::post('/agent_close/{sender_id}', 'AgentController@closeAgentThread');
功能:
public function closeAgentThread($sender_id){
$bot = new BotManController();
return $bot->TakeThreadControl($sender_id);
}
萧十郎
一只甜甜圈
相关分类