title: How to send Cross Domain Ajax POST with Laravel
body: <p>I am trying to send a cross-domain post call using AJAX from one of my Laravel sites, to another.</p>
  
  <p>The other topic I saw addressed the first issue I was running into with Access Control headers: <a href="https://stackoverflow.com/questions/27311091/jquery-cross-domain-ajax-post-with-laravel">Jquery: Cross-domain ajax &#39;POST&#39; with laravel</a></p>
  
  <p>I am getting a 419 error, implying that I am not using a CSRF token, but with either token I use (local token or other domain token) it doesn't work.</p>
  
  <pre><code>var CSRF_TOKEN = {{ csrf_token() }};
  $.ajaxSetup( { headers : { 'X-CSRF-TOKEN' : CSRF_TOKEN } } );
  
  var tracking_id = "{{ isset( $tracking_id ) ? $tracking_id : 'test-20' }}";
  $.ajax({
      type: 'POST',
      url: 'https://example.com/beacon',
      crossDomain: true,
      data: { 'tracking_id': tracking_id },
      success: function(responseData, textStatus, jqXHR) {
          console.log( 'Click!' );
      },
      error: function (responseData, textStatus, errorThrown) {
          console.log( responseData );
      }
  });
  </code></pre>