title: AJAX-Request: Access-Control-Allow-Header doesn't allow X-CSRFToken
body: <p>I've got a little question on an ajax-request.
  In my code I want to access a php-script which 'grabs' some content via an ajax-call. You can see the jQuery-code below:</p>
  
  <pre><code>&lt;div id="ajaxcontent"&gt;&lt;/div&gt;
  
  &lt;script type='text/javascript' src='http://www.vhb.wiwi.uni-wuerzburg.de/bp1/wp/wp-includes/js/jquery/jquery.js?ver=1.12.4'&gt;&lt;/script&gt;
  
  &lt;script&gt;
  jQuery(document).ready(function($){
      $.ajax({
          url: "http://www.vhb.wiwi.uni-wuerzburg.de/bp1/wp/contentgrabber/contentgrabber.php",
          type: 'GET',
          data: "page_id=73&amp;ajax=1",
          crossDomain: true,
          success: function(data){
              $("#ajaxcontent").html(data);
          }
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>The URL works fine, so by clicking onto, it show's me the stuff I want to load. The problem is, that I get the following two Errors:
  <a href="https://i.stack.imgur.com/lh1tL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lh1tL.png" alt="the two errors i get when running the code"></a></p>
  
  <p>Somehow my server doesn't seem to allow some kind of X-CSRFToken. Unfortunatelly I have no great experience with that kind of requests, but I think that something more has to be changed in the php-file:</p>
  
  <pre><code>&lt;?php
  header("Access-Control-Allow-Origin:*");
  header("Access-Control-Allow-Headers:*");
  
  
  if(isset($_GET["page_id"]))
  {
      $page_id=$_GET["page_id"];
  
      $url = "http://www.vhb.wiwi.uni-wuerzburg.de/bp1/wp/?page_id=".$_GET["page_id"];
  
      $website_content = file_get_contents($url);
  
      $part_1 = substr($website_content, strpos($website_content, "&lt;!-- CONTENTGRABBER_START --&gt;")-27);
      $content = substr($part_1,27, strpos($part_1, "&lt;!-- CONTENTGRABBER_END --&gt;"));
  
      $part_2 = substr($website_content, strpos($website_content, "&lt;!-- CONTENT_STYLE_GRABBER_START --&gt;")-36);
      $content_style = substr($part_2,36, strpos($part_2, "&lt;!-- CONTENT_STYLE_GRABBER_END --&gt;")); 
  
      if(!isset($_GET["ajax"]))
      {
          $css_include = '&lt;link rel="stylesheet" type="text/css" href="http://www.vhb.wiwi.uni-wuerzburg.de/bp1/wp/wp-content/plugins/thrive-visual-editor/editor/css/thrive_flat.css"&gt;';
          echo $css_include;
      }
  
      echo "&lt;link rel='dns-prefetch' href='//fonts.googleapis.com' /&gt;";
      echo utf8_decode($content_style);
      echo utf8_decode($content);
  }
  
  ?&gt;
  </code></pre>
  
  <p>I tried some solutions posted on similar questions, but nothing worked out so far. Thank you in advance for any help!</p>