Bootstrap Toggle switch with ajax update to mysql in Laravel
In this Post We Will Explain About is Bootstrap Toggle switch with ajax update to mysql in Laravel With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Bootstrap Toggle Inside jQuery DataTable in Laravel Example
In this post we will show you Best way to implement Laravel Bootstrap Toggle switch Update DB field using Ajax, hear for Create Radio Button Toggle Switch with Bootstrap, jQuery & Laravel with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.
Laravel – Toggle value in database with checkbox and ajax
I have a very easy task.but some devloper is stuck so here Update a value in mysql table when button is on click using Laravel with MYSQL and Jquery Means simple meaningCreate Checkbox Toggle Switch with Bootstrap, jQuery & Laravel.
public function activation(Request $request) { $Product = Product::findOrFail($request->product_id); if($Product->active == 1){ $Product->active = 0; } else { $Product->active = 1; } return response()->json([ 'data' => [ 'success' => $Product->save(), ] ]); }
And then in the front-end part:
$(document).ready(function(){ $("input:checkbox").change(function() { var product_id = $(this).closest('tr').attr('id'); $.ajax({ type:'POST', url:'https://www.pakainfo.com/admin/activation', headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}' }, data: { "product_id" : product_id }, success: function(data){ if(data.data.success){ //here some source code - do something } } }); }); });
You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example
I hope you have Got What is Submit Laravel Bootstrap Form without Page Refresh using jQuery, Ajax And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.