JQuery $ .ajax returns nothing, but only in Google Chrome?

I hope someone can help me with this, as I am at a loss. I'm trying to just upload a text file to a page at runtime using jquery - everything works fine in IE8 (8.0.7600.16385), Firefox 3.6.3, however in Google Chrome 5.0.375.55 the "data" returns as nothing - I get an empty notification field .

This is the code I use;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Animation Test</title>
    <script type="text/javascript" language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $.ajax({
                url: 'level1.txt',
                success: function (data) {
                    alert(data);
                },
                async: true,
                type: 'GET'
            });
        });
</script> 
</head>
<body>
    <canvas id="canvas" width="640" height="480">
        Unsupported Browser
    </canvas>

</body>
</html>

The download file is a simple text file containing this:

Central Cavern
100
O.........1.C....C...........1.O
O................1.............O
O..............................O
O..............................O
O......................B1..B...O
O=============~~~~=~~~~========O
O.............................1O
O===...........................O
O............A..OOO.B..........O
O====...<<<<<<<<<<<<<<<<<<<<...O
O............................==O
O..............................O
O..........B........OOO.....===O
O....===============...........O
O%............................XO
O==============================O

(Yes, this is the first level from Manic Miner! I am making a javascript version using the html5 canvas to use it.)

I have a complete loss - it cannot be code, because it works in other 2 browsers - is there a problem with jquery and this version of Chrome?

Thanks for reading!

Show.

+3
1

-? , , Chrome . . .

Chrome - .

Chrome , : --allow-file-access-from-files.

+6

Source: https://habr.com/ru/post/1748689/


All Articles