title: Send data to controller via Ajax
body: <p>I am new to Ajax and I am using laravel, now i want to have a delete button that will send the id of the item that i want to delete to controller. Here is my code.</p>
  
  <p>Views</p>
  
  <pre><code>      &lt;div class="row"&gt;
          @foreach($photos as $photo)
       &lt;div class="col-xs-3 col-md-1"&gt;
      &lt;button onclick="removeItem({{$photo-&gt;id}}); return false;"&gt;Delete&lt;/button&gt;   
            &lt;/div&gt; 
            @endforeach
  
          &lt;/div&gt;
  </code></pre>
  
  <p>Here is my script for now, doesnt have an idea on this</p>
  
  <pre><code>     &lt;script type="text/javascript"&gt;
      function removeItem($myvar) {
          alert($myvar);
      }
      &lt;/script&gt;
  </code></pre>
  
  <p>I want to send this to this route </p>
  
  <pre><code>       Route::post('deletephoto','GamefarmsController@deletephoto');
  </code></pre>