JQuery $.ajax doesn't return anything, but only in Google Chrome!?
        Posted  
        
            by Shawson
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Shawson
        
        
        
        Published on 2010-06-05T21:25:15Z
        Indexed on 
            2010/06/05
            21:32 UTC
        
        
        Read the original article
        Hit count: 313
        
Hi All,
I'm hoping someone can help me with this as I'm at a loss. I'm trying to simply load a plain text file into 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" comes back as nothing- i get an empty alert box.
This is the code i'm using;
<!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 file I'm loading in is a plain 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- it's the first level from Manic Miner! I'm making a javascript version using the html5 canvas to get my head around using it.)
I'm at a total loss- it can't be the code because it runs in the other 2 browsers- is there an issue with jquery and this version of Chrome?
Thanks for reading!!
Shaw.
© Stack Overflow or respective owner