title: execute a jquery ajax code withot open a web page that execute it
body: <p>i make a project with laravel 6
  and i have database table name is buildings 
  id - wood - clay - iron - crop - created_at - updated_at
  1 - 25 - 54 - 57 - 63 - null - null 
  so i make jquery ajax code to increment every column by 1 as test</p>
  
  <p>game.js</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function(){
  
  setInterval(function(){ 
      var dataString    = 'id=1';
      $.ajaxSetup({ headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')} });
      $.ajax({
      type: "post", 
      url: "{{ route('upgradeBuildings') }}",
      data: dataString,
      cache: false,
      beforeSend: function(){},
      success: function(data){
          $('.x').html(data);
      },
      error: function(err){console.log(err);}
      });
  }, 1000);
  
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>LogsController </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  namespace App\Http\Controllers;
  use Illuminate\Http\Request;
  use DB;
  use App\Logs;
  use App\Buildings;
  
  class LogsController extends Controller
  {
  
      public function upgradeBuildings(Request $request)
      {
          $id = $request-&gt;id;
          $updatecount = Buildings::increment("wood", "1");
          $buildings = Buildings::get()-&gt;first();
          $wood = $buildings-&gt;wood;
          return Response($wood);
      }
  
      public function village()
      {
          $buildings = Buildings::get();
          $users = DB::table('users')-&gt;get();
          $settings = DB::table('settings')-&gt;get()-&gt;first();
          return view('game.village', compact('buildings', 'settings', 'users')); 
      }
   
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>but these code is working when i opened page name village that's has game.js on it
      </p>
  
  <p>i want this code working without i open this page </p>