0

I desperately need your help. And although I have no idea of javascript and also no idea of HTML. But I need this function. But she does not want to work:

<script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript">
function checkVersion()
{
    $.get( "http://citizen.bplaced.net/version.php", function( data ) {
            if (data == "04") {
                return true;
            } else {
                return false;
            }
    });
}
</script>

and in the version.php file is:

<?php header('Access-Control-Allow-Origin: *'); ?>
04    
Lion
  • 1
  • 2
  • If you check the console after making the request you'll see this error: No `'Access-Control-Allow-Origin' header is present on the requested resource.` This means that you will not be able to call the URL you're attempting as it does not explicitly allow cross-domain requests. Closing as a duplicate. – Rory McCrossan Jul 15 '17 at 11:35
  • Open console (F12) and read text error. – Smiranin Jul 15 '17 at 11:36
  • @RoryMcCrossan thanks for the fast answer, but when i add this code to my htaccess it also dont work :( `Header set Access-Control-Allow-Origin "*"` – Lion Jul 15 '17 at 12:11
  • That needs to go on the server response, not in your JS. As I mentioned, unless you control the server you're calling, then your code will not work – Rory McCrossan Jul 15 '17 at 13:27

0 Answers0