Jquery Mobile JSON无法在某些浏览器上加载

时间:2012-02-15 04:56:36

标签: jquery ajax json getjson

所以基本上,我有一个$ .getJSON调用似乎在Chrome和iPhone 4S Safari浏览器上工作,但是没有在其他一些工作,包括iPad 2 Safari。我在pageinit方法中创建了一个对话框,这显示在所有浏览器上。我更改了我的代码,因此在JSON调用之后,它会创建一个包含JSON数据字段的对话框。它在Chrome上显示正常,但整个JSON调用似乎在iPad上被忽略(b / c的方法无声失败)。所以,我认为JSON网址存在问题,但我不确定。页面的网址为www.shivamthapar.com/sportsapp/baseball-boys.php,json文件网址为www.shivamthapar.com/sportsapp/src/json/baseball.json。这是我的代码:

使用Javascript:

$("#main").live('pageinit', function(event) {

            getList();

        });
function getList(){
        $.getJSON('../src/json/baseball.json', function(data) { 
            alert(data.super[0].levels[0].games[0].versus);
                });
} 

JSON:

{
    "super": [
        {
            "gender": "boys",
            "levels": [
                {
                    "level": "varsity",
                    "games": [
                        {
                            "versus": "Fullerton",
                            "homeaway": "Home",
                            "month": "September",
                            "date": "27",
                            "year": "2012",
                            "time": "3:00",
                            "ampm": "pm",
                            "troyscore": 32,
                            "vsscore": 41
                        },
                        {
                            "versus": "Sunny Hills",
                            "homeaway": "Away",
                            "month": "March",
                            "date": "28",
                            "year": "2012",
                            "time": "2:00",
                            "ampm": "pm",
                            "troyscore": "20",
                            "vsscore": "17"
                        }
                    ]
                },
                {
                    "level": "jv",
                    "games": [
                        {
                            "versus": "Sonora",
                            "homeaway": "Home",
                            "month": "January",
                            "date": "20",
                            "year": "2012",
                            "time": "3:00",
                            "ampm": "pm",
                            "troyscore": "15",
                            "vsscore": "21"
                        },
                        {
                            "versus": "Valencia",
                            "homeaway": "Away",
                            "month": "April",
                            "date": "30",
                            "year": "2012",
                            "time": "4:00",
                            "ampm": "pm",
                            "troyscore": "40",
                            "vsscore": "1"
                        }
                    ]
                }
            ]
        },
        {
            "gender": "girls",
            "levels": [
                {
                    "level": "varsity",
                    "games": [
                        {
                            "versus": "Acacia",
                            "homeaway": "Home",
                            "month": "February",
                            "date": "27",
                            "year": "2012",
                            "time": "7:00",
                            "ampm": "pm",
                            "troyscore": "32",
                            "vsscore": "41"
                        },
                        {
                            "versus": "LV",
                            "homeaway": "Away",
                            "month": "March",
                            "date": "28",
                            "year": "2012",
                            "time": "3:30",
                            "ampm": "pm",
                            "troyscore": "20",
                            "vsscore": "17"
                        }
                    ]
                },
                {
                    "level": "jv",
                    "games": [
                        {
                            "versus": "Commonwealth",
                            "homeaway": "Home",
                            "month": "January",
                            "date": "20",
                            "year": "2012",
                            "time": "5:00",
                            "ampm": "pm",
                            "troyscore": "15",
                            "vsscore": "21"
                        },
                        {
                            "versus": "Xishan",
                            "homeaway": "Away",
                            "month": "April",
                            "date": "30",
                            "year": "2012",
                            "time": "4:00",
                            "ampm": "pm",
                            "troyscore": "40",
                            "vsscore": "1"
                        }
                    ]
                }
            ]
        }
    ]
}

0 个答案:

没有答案