How to Delete Data in Laravel using AJAX without Refreshing the Page
HTML-код
- Опубликовано: 19 май 2023
- #deletedatainlaravelusingajax
Laravel Simple Blog Website Project Tutorial For Beginners to Advance Playlist Link : • Laravel Simple Blog We...
Buy me a Coffee 🥰 : www.buymeacoffee.com/yaminshakil
Support This Channel :
Join this channel to get access to perks:
/ @webtechknowledge
Your support will be really appreciated.
Thanks For Watching.
I hope This video was helpful. If you have any questions then let me know in the comment section.
Best of luck
#webtechknowledge
You can connect with me with the given links below:
Facebook Link: / yaminshakil07
Instagram Link: / yamin_shakil
Twitter Link: / yaheashakil
function deletepost(id)
{
if(confirm("Are you sure to delete this"))
{
$.ajaxSetup({
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url:'delete_post/'+id,
type:'DELETE',
success:function(result)
{
$("#"+result['tr']).slideUp("slow");
}
});
}
}
Hi ...brother
You're the best one. To explain the concepts of laravel, please make more videos if possible to you. Thank you.
what an excellent explanation thanks a lot🙏🙏🙏
Nice video
Thank you sir
function deletepost(id)
{
if(confirm("Are you sure to delete this"))
{
$.ajaxSetup({
headers:
{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url:'delete_post/'+id,
type:'DELETE',
success:function(result)
{
$("#"+result['tr']).remove()
}
});
}
}
Hey Sir u defined so well but the preferred way is to remove the element instead of hiding it, use remove method instead of slideup, Jazaka Allah