title: Update using onclick
body: <p>I've been trying to create an update status for only one value in my database which is <code>isdisabled</code> from 0 to 1 by using a AJAX onclick. Here are my codes:</p>
  <p>index.blade.php :</p>
  <pre><code>$('body').on('click', '.disableMediaOrder', function(){
      var id = $(this).data(&quot;id&quot;);
      confirm(&quot;Are you sure you want to disable this ?&quot;);
  
      $.ajax({
          url: &quot;{{ route('media-order.disable') }}&quot;+'/'+id,
          method: &quot;GET&quot;,
          success: function (data){
              tableMediaOrder.draw();
          },
          error: function (data) {
              console.log('Error:', data);
          }
      });
  });
  </code></pre>
  <p>Controller :</p>
  <pre><code>public function index(Request $request)
  {
      if ($request-&gt;ajax()) {
          $data = MediaOrder::get();
          return DataTables::of($data)
                  -&gt;addIndexColumn()
                  -&gt;addColumn('action',function($row){
                      $btn = '&lt;a href=&quot;javascript:void(0)&quot; id=&quot;editMediaOrder&quot; data-toggle=&quot;tooltip&quot;  data-id=&quot;'.$row-&gt;id.'&quot; data-original-title=&quot;Edit&quot; class=&quot;edit btn btn-primary btn-sm editMediaOrder&quot; value=&quot;{{ csrf_token() }}&quot;&gt;Edit&lt;/a&gt;';
  
                         $btn = $btn.' &lt;a href=&quot;javascript:void(0)&quot; data-toggle=&quot;tooltip&quot;  data-id=&quot;'.$row-&gt;id.'&quot; data-original-title=&quot;Delete&quot; class=&quot;btn btn-danger btn-sm deleteMediaOrder&quot; value=&quot;{{ csrf_token() }}&quot;&gt;Delete&lt;/a&gt;';
  
                         $btn = $btn.' &lt;a href=&quot;javascript:void(0)&quot; data-toggle=&quot;tooltip&quot; id=&quot;disableMediaOrder&quot;  data-id=&quot;'.$row-&gt;id.'&quot; data-original-title=&quot;Delete&quot; class=&quot;btn btn-danger btn-sm disableMediaOrder&quot; value=&quot;{{ csrf_token() }}&quot;&gt;Disable&lt;/a&gt;';
  
                          return $btn;
                  })
                  -&gt;rawColumns(['action'])
                  -&gt;make(true);
      } else {
          $groups = Group::all();
          $media_order = DB::table('media_order')-&gt;get();
          $moo = MediaOrder::orderBy('nomor','asc')-&gt;get();
          $users = User::orderBy('name', 'asc')-&gt;get();
          return view('media-order.index')-&gt;with(compact('users','moo','groups'));
      }
  }
  
  public function disable(Request $request, $id)
  {
      DB::unprepared('SET IDENTITY_INSERT media_order ON');
      MediaOrder::updateOrCreate(['id'=&gt; $request-&gt;id],
          [
              'isdisabled' =&gt; 1,
          ]);
      DB::unprepared('SET IDENTITY_INSERT media_order OFF');
  
      if ($request-&gt;ajax()){
          return redirect_ajax_notification('media-order.index');
      }else{
          return redirect_ajax('media-order.index');
      }
  }
  </code></pre>
  <p>And here is my route:</p>
  <pre><code>Route::post('/MediaOrder/disable', 'MediaOrderController@disable')-&gt;name('media-order.disable');
  </code></pre>
  <p>And sadly it comes up with 'NotFoundHTTPException;' maybe someone can assist me in solution for this.</p>