javascript - AJAX-Request: Access-Control-Allow-Header doesn't allow X-CSRFToken -


i've got little question on ajax-request. in code want access php-script 'grabs' content via ajax-call. can see jquery-code below:

<div id="ajaxcontent"></div>  <script type='text/javascript' src='http://www.vhb.wiwi.uni-wuerzburg.de/bp1/wp/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>  <script> jquery(document).ready(function($){     $.ajax({         url: "http://www.vhb.wiwi.uni-wuerzburg.de/bp1/wp/contentgrabber/contentgrabber.php",         type: 'get',         data: "page_id=73&ajax=1",         crossdomain: true,         success: function(data){             $("#ajaxcontent").html(data);         }     }); }); </script> 

the url works fine, clicking onto, show's me stuff want load. problem is, following 2 errors: the 2 errors when running code

somehow server doesn't seem allow kind of x-csrftoken. unfortunatelly have no great experience kind of requests, think more has changed in php-file:

<?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, "<!-- contentgrabber_start -->")-27);     $content = substr($part_1,27, strpos($part_1, "<!-- contentgrabber_end -->"));      $part_2 = substr($website_content, strpos($website_content, "<!-- content_style_grabber_start -->")-36);     $content_style = substr($part_2,36, strpos($part_2, "<!-- content_style_grabber_end -->"));       if(!isset($_get["ajax"]))     {         $css_include = '<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">';         echo $css_include;     }      echo "<link rel='dns-prefetch' href='//fonts.googleapis.com' />";     echo utf8_decode($content_style);     echo utf8_decode($content); }  ?> 

i tried solutions posted on similar questions, nothing worked out far. thank in advance help!


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -