I am trying to populate my databse using ajax+laravel. but when I am trying to post my delete button I get some errors. 2 to be exact 1) I cant find a way to make it call destroy function from inside the controller 2) The Javascript I have inside my blade does not execute (works when the button is created inside the blade) that my problematic button
<form method="post" class="delete_form" action=" $this->callAction(\\'destroy\\', [\\'id\\' => $row[\\'id\\']]); ">
<input type="hidden" name="_method" value="DELETE"/>
<button type="submit" class="btn btn-outline-danger">Delete</button>
</form>
and I am trying to execute this from inside the same controller (this part works I I crate a button in my blade (did it for testing))
public function destroy($id)
{
$userList = users::find($id);
$userList->delete();
return redirect()->route('users.index')->with('successs', 'Data Deleted');
}