when i use this code
<td class="d-flex justify-content-center" onclick="fct()"><a href="{{ path('admin_card_delete', {slug:restaurantData.slug,id:restaurant.id}) }}"><img src="{{ asset('images/products/cancel.png') }}"></a></td>
</tbody>
i'm redirected on my deleting page and all things are going well, and the selected element is deleted without any issue.
But when i try this
<td class="d-flex justify-content-center" onclick="fct()"><img src="{{ asset('images/products/cancel.png') }}"></td>
<script>
function fct(){
if(confirm("are you sure to delete this item ?")===true)
{
document.location.href="{{ path('admin_card_delete', {slug:restaurantData.slug,id:restaurant.id}) }}"
}}
</script>
The redirection also goes well but for some reason remove method is not working, here is the code of my deleting page.
$em->remove($toRemove);
$em->flush();
return $this->redirectToRoute('admin_restaurant_card',[
'slug' => $slug,
'id' => $id
]);