Bootstrap Toggle switch with ajax update to mysql in Laravel

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!.

Read Also:  How to uninstall cordova and ionic in ubuntu?

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:

Read Also:  jQuery An Animated Scroll To Top Button

$(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

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.

Read Also:  Form Validation Using React Examples

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Bootstrap Toggle switch with ajax update to mysql in PHP
  2. Read Also:  DataTables Checkbox Check All Example
  3. Read Also:  Toggle Switches Laravel, Ajax and jQuery example
  4. Read Also:  Login Multiple Skype Accounts on Windows, Mac, Linux
  5. Read Also:  Learn Angular 5 from Scratch - angular 5 Tutorial
  6. Read Also:  Laravel Bootstrap Toggle switch Update DB field using Ajax
  7. Read Also:  Bootstrap Toggle switch Update Database field using Ajax
  8. Read Also:  Laravel Ajax Bootstrap Toggle switch Update MySQL
  9. Read Also:  Laravel 6 Bootstrap Toggle Switch With Ajax Update To Mysql
  10. Read Also:  Convert Array To Object With PHP
CLOSEX