title: laravel jquery count table row append auto increment id
body: <p>how can i achieved this in my Laravel application using ajax request.
  My logic is </p>
  
  <ol>
  <li><p>on page reload table auto numbering table row
  {<strong>example.</strong> <code>td=1,td=2,td=3</code>}</p></li>
  <li><p>upon Ajax post submitted append data + auto numbering to existing number on the table
  {<strong>example.</strong> <code>td=1,td=2,td=3,td=4</code>}</p></li>
  </ol>
  
  <p>as you can see <code>td=4</code> is the new added value .. 
  how can i achieved this and make sure when page reload the numbering maintain.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>$('#myform').on( "submit", function( event ) {
    event.preventDefault(); 
    $.ajax({
      type:'POST',
      url:"{{ URL::route('test') }}",
      data:$(this).serialize(),
          success:function(data){
            console.log(data)
                          var $table = $('#myTable');
                           for (var i=0;i&lt;1;i++) {
                                 var $row = $table.find("tbody").append("&lt;tr&gt;"+
                                    "&lt;td&gt;"+i+"&lt;/td&gt;"+
                                    "&lt;td id='name'&gt;"+data.name+"&lt;/td&gt;"+
                                    "&lt;td id='code'&gt;"+data.code+"&lt;/td&gt;"+
                                    "&lt;/tr&gt;").children("tr:eq("+i+")"); 
                           } }});});
  </code></pre>