title: ajax is loading data twice from database using laravel php
body: <p>hi i am trying to load data from database using ajax . but the data is loading twice on the html page.</p>
  <pre><code>&lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
  
      $('button').click(function(){
          $.ajax({
              url:&quot;{{route('zaeemajax')}}&quot;,
              method:&quot;get&quot;,
              datatype:&quot;json&quot;,
              success:function(response){
                   console.log(response);
                  var tabledata=&quot;&quot;;
                  $.each(response,function(key,value){
                   tabledata +=&quot;&lt;tr&gt;&quot;;
                   tabledata +=&quot;&lt;td&gt;&quot;+value.name+&quot;&lt;/td&gt;&quot;;
                   tabledata +=&quot;&lt;td&gt;&quot;+value.price+&quot;&lt;/td&gt;&quot;;
                   tabledata +=&quot;&lt;td&gt;&quot;+value.category+&quot;&lt;/td&gt;&quot;;
                   tabledata +=&quot;&lt;/tr&gt;&quot;;
                  
                  });
                    $('#show tbody').append(tabledata);
              }
  
  
          });
  
      });
  &lt;/script&gt;
  
  </code></pre>
  <p>in my controller i am return product data as json</p>
  <pre><code>public function showallpro()
      {
          $product=Product::all();
          return response()-&gt;json($product);
  
      }
  </code></pre>
  <p>there are only two fields right now in the products table but wheneever i try to fetch data from database it is showing the same data twice</p>
  <p>here is the html code where i am trying to show the fecthed data from the data base</p>
  <pre><code>&lt;table id=&quot;show&quot; style=&quot;border: 1px solid black;&quot;&gt;
      &lt;tr&gt;
          &lt;th&gt;name&lt;/th&gt;
          &lt;th&gt;Price&lt;/th&gt;
          &lt;th&gt;Category&lt;/th&gt;
  
      &lt;/tr&gt;
      &lt;tbody&gt;
  
  &lt;/tbody&gt;
  &lt;/table&gt;
  
  &lt;button type=&quot;&quot;&gt;Show Data&lt;/button&gt;
  
  
  
  </code></pre>
  <p><a href="https://i.stack.imgur.com/C7GDs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C7GDs.png" alt="enter image description here" /></a></p>