Laravel Ajax Request using X-editable bootstrap Plugin Example

January 14, 2018 | Category : Laravel 5.5 Laravel 5 Ajax JQuery Plugin JQuery Bootstrap Laravel PHP

Hi Developer,

In this tutorial, i will let you know how to save data using ajax request with X-editable bootstrap plugin in laravel 5 application. you can simple call ajax request with z-editable bootstrap and update data using ajax request.

I was thinking to share something new thing with laravel 5 application and i used before X-editable bootstrap plugin. it's amazing for ajax. really nice layout and simple way to use. we can also use x-editable plugin without bootstrap. so don't worry about it to use. i make simple and easy example for laravel application. so you can easily understand and use it with other application too.

So, let's just follow few bellow step and you will get layout like as bellow screen shot, at the end of all step. let's follow:


Add Routes: routes/web.php

Route::get('/get-users', 'HomeController@getUsers');

Route::post('/update-user', 'HomeController@updateUser');

Add Methods: app/Http/Controllers/HomeController.php


namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\User;

class HomeController extends Controller



* Create a new controller instance.


* @return void


public function getUsers()


$users = User::all();

return view('users',compact('users'));



* Create a new controller instance.


* @return void


public function updateUser(Request $request)


User::find($request->pk)->update([$request->name => $request->value]);

return response()->json(['success'=>'done']);



View File: resources/views/users.blade.php

<!DOCTYPE html>



<title>Laravel Ajax Request using X-editable bootstrap Plugin Example</title>

<meta name="csrf-token" content="{{ csrf_token() }}">

<!-- Latest compiled and minified CSS -->

<link rel="stylesheet" href="">

<script src=""></script>

<script src=""></script>

<link href="" rel="stylesheet"/>

<script src=""></script>



<div class="container">

<h3>Laravel Ajax Request using X-editable bootstrap Plugin Example</h3>

<table class="table table-bordered">




<th width="100px">Action</th>


@foreach($users as $user)


<td><a href="" class="update" data-name="name" data-type="text" data-pk="{{ $user->id }}" data-title="Enter name">{{ $user->name }}</a></td>

<td><a href="" class="update" data-name="email" data-type="email" data-pk="{{ $user->id }}" data-title="Enter email">{{ $user->email }}</a></td>

<td><button class="btn btn-danger btn-sm">Delete</button></td>






<script type="text/javascript">


headers: {

'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')




url: '/update-user',

type: 'text',

pk: 1,

name: 'name',

title: 'Enter name'




Now you can run above example and let's see :)

I hope you found you solution...