title: Update paginator laravel in ajax
body: <p>I create a page on which there is a table with a paginator. I post a request to specify the output of rows from the database for insertion into the table. However, the paginator remains old. How should I change it?
  Get a request for a new page or insert all the HTML code that comes from the controller is not satisfied.</p>
  
  <p>Code view:</p>
  
  <pre><code>&lt;table class="table table-bordered text-center table-hover" id="table_list"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
          &lt;th&gt;id&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input type="text" class="form-control" id="id_card" value=""&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          @if($dats)
              @foreach($dats as $data)
                  &lt;tr&gt;
                      &lt;td&gt;&lt;div class="help" data-id="{{ $data['id'] }}"&gt; {{$data['id']}}&lt;/div&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              @endforeach
          @endif
      &lt;/tbody&gt;
  &lt;/table&gt;
  {{ $dats-&gt;links() }} // After completing the ajax, the link remains old and allows you to navigate through the old table
  </code></pre>
  
  <p>Js code in view:</p>
  
  <pre><code>$('#id_card').on('keyup', function(){ // search
              value = $(this).val();
              $.ajax({
                  type: 'POST',
                  url: '/home',
                  data: {
                      search: value,
                      code: 1,
                      _token: '{{csrf_token()}}'
                  },
                  success: function (data) {
                      $('#table_list').empty();
                      $('#table_list').append(data);  // update table 
                       //update paginator links
                  },
                  error: function(data){
                      console.log(data);
                  }
              })
          })
  </code></pre>
  
  <p>Code controller</p>
  
  <pre><code>public function search(Request $request){
  $models= Model::where('table','LIKE','%'.$request-&gt;input('search').'%')-&gt;paginate(4);
  $str = "";
  foreach($models as $model){
      $str .= '&lt;tr&gt;'.
              '&lt;td&gt;'. $model["id"].'&lt;/td&gt;'.
              '&lt;/tr&gt;';
  }
  print($str);
  return;
  </code></pre>
  
  <p>}</p>