JSONP请求状态代码200但错误

时间:2013-03-04 06:04:08

标签: javascript ajax json

只是尝试使以下代码无效,

$.ajax({
            url: "http://www.futhead.com/fifa/players/search/",
            data: {
                term: 'Ibra'
            },
            dataType: 'jsonp',
            jsonp: false,
            crossDomain: true,
            jsonpCallback: 'callback',
            complete: function (xhr, status) {
                if (status === 'error' || !xhr.responseText) {
                    console.log('Sample of error data:', xhr);
                } else {
                    var data = xhr.responseText;
                }
        }
});

在控制台内部日志中,它返回200状态,但返回基于xhr的错误

此内容的当前网址托管在http://fut.paid4upload.net/api/

3 个答案:

答案 0 :(得分:1)

JSONP通过HTTP GET而不是HTTP POST

type: 'get',

您只需删除type$.ajax()默认其类型为GET,

答案 1 :(得分:1)

如果jQuery Ajax函数不起作用,请尝试这样的事情。我在我的一个项目中完成了这项工作

像这样加载脚本。

<script type="text/javascript" src="http://www.futhead.com/fifa/players/search/?term=Ibra"></script>

服务器应该发送这样的响应。

var yourData = [{"rating": 89, "clubid": 84, "skill_moves": 5, "height": 195, "attack_work_rate": 0, "price_pc": 7600000, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/46.png", "playerid": 11669, "leagueid": 4, "nationid": 49, "revision": "IF", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/41236.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/73.png", "attr6": "HEA 79", "attr4": "DRI 88", "attr5": "DEF 52", "attr2": "SHO 90", "attr3": "PAS 82", "attr1": "PAC 78", "foot": "Right", "weak_foot": 4, "price_xbl": 1593885, "rplayerid": 41236, "league": "Ligue 1", "rare": true, "name": "Zlatan Ibrahimovi\u0107", "level": "gold", "defensive_work_rate": 1, "vote_sum": 190, "price_ps3": 2027887, "position": "ST"}, {"rating": 88, "clubid": 84, "skill_moves": 5, "height": 195, "attack_work_rate": 0, "price_pc": 1995185, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/46.png", "playerid": 577, "leagueid": 4, "nationid": 49, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/41236.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/73.png", "attr6": "HEA 78", "attr4": "DRI 87", "attr5": "DEF 51", "attr2": "SHO 88", "attr3": "PAS 79", "attr1": "PAC 77", "foot": "Right", "weak_foot": 4, "price_xbl": 498482, "rplayerid": 41236, "league": "Ligue 1", "rare": true, "name": "Zlatan Ibrahimovi\u0107", "level": "gold", "defensive_work_rate": 1, "vote_sum": 695, "price_ps3": 659250, "position": "ST"}, {"rating": 81, "clubid": 36, "skill_moves": 4, "height": 180, "attack_work_rate": 0, "price_pc": 1005, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/34.png", "playerid": 3116, "leagueid": 13, "nationid": 20, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/158372.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/34.png", "attr6": "HEA 56", "attr4": "DRI 83", "attr5": "DEF 52", "attr2": "SHO 75", "attr3": "PAS 74", "attr1": "PAC 84", "foot": "Right", "weak_foot": 4, "price_xbl": 1004, "rplayerid": 158372, "league": "Bundesliga", "rare": true, "name": "Ibrahim Afellay", "level": "gold", "defensive_work_rate": 0, "vote_sum": 39, "price_ps3": 992, "position": "LW"}, {"rating": 72, "clubid": 312, "skill_moves": 4, "height": 170, "attack_work_rate": 2, "price_pc": 3828, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/118.png", "playerid": 5958, "leagueid": 13, "nationid": 38, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/183909.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/36.png", "attr6": "HEA 48", "attr4": "DRI 78", "attr5": "DEF 38", "attr2": "SHO 59", "attr3": "PAS 65", "attr1": "PAC 87", "foot": "Left", "weak_foot": 3, "price_xbl": 1895, "rplayerid": 183909, "league": "Bundesliga", "rare": true, "name": "Ibrahima Traor\u00e9", "level": "silver", "defensive_work_rate": 0, "vote_sum": 13, "price_ps3": 2622, "position": "LM"}, {"rating": 71, "clubid": 47, "skill_moves": 2, "height": 187, "attack_work_rate": 0, "price_pc": null, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/136.png", "playerid": 11290, "leagueid": 1, "nationid": 13, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/210320.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/44.png", "attr6": "HEA 69", "attr4": "DRI 69", "attr5": "DEF 69", "attr2": "SHO 51", "attr3": "PAS 66", "attr1": "PAC 82", "foot": "Right", "weak_foot": 3, "price_xbl": null, "rplayerid": 210320, "league": "Serie A", "rare": true, "name": "Ibrahima Mbaye", "level": "silver", "defensive_work_rate": 2, "vote_sum": 8, "price_ps3": null, "position": "LB"}, {"rating": 71, "clubid": 422, "skill_moves": 3, "height": 190, "attack_work_rate": 0, "price_pc": 1100, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/136.png", "playerid": 8307, "leagueid": 15, "nationid": 13, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/197238.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/110089.png", "attr6": "HEA 74", "attr4": "DRI 64", "attr5": "DEF 42", "attr2": "SHO 68", "attr3": "PAS 51", "attr1": "PAC 78", "foot": "Right", "weak_foot": 2, "price_xbl": 316, "rplayerid": 197238, "league": "Russian League", "rare": false, "name": "Ibrahima Bald\u00e9", "level": "silver", "defensive_work_rate": 0, "vote_sum": 6, "price_ps3": 335, "position": "ST"}, {"rating": 69, "clubid": 361, "skill_moves": 3, "height": 188, "attack_work_rate": 0, "price_pc": 310, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/36.png", "playerid": 7338, "leagueid": 9, "nationid": 9, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/190821.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/922.png", "attr6": "HEA 67", "attr4": "DRI 74", "attr5": "DEF 64", "attr2": "SHO 55", "attr3": "PAS 66", "attr1": "PAC 70", "foot": "Right", "weak_foot": 3, "price_xbl": 223, "rplayerid": 190821, "league": "Tippeligaen", "rare": false, "name": "Abdisalam Ibrahim", "level": "silver", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 410, "position": "CM"}, {"rating": 66, "clubid": 319, "skill_moves": 4, "height": 167, "attack_work_rate": 0, "price_pc": 300, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/133.png", "playerid": 8315, "leagueid": 14, "nationid": 12, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/197359.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/78.png", "attr6": "HEA 54", "attr4": "DRI 72", "attr5": "DEF 36", "attr2": "SHO 54", "attr3": "PAS 66", "attr1": "PAC 75", "foot": "Left", "weak_foot": 2, "price_xbl": 625, "rplayerid": 197359, "league": "SPL", "rare": false, "name": "Rabiu Ibrahim", "level": "silver", "defensive_work_rate": 0, "vote_sum": 3, "price_ps3": 613, "position": "CAM"}, {"rating": 66, "clubid": 253, "skill_moves": 4, "height": 167, "attack_work_rate": 0, "price_pc": 600, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/133.png", "playerid": 12344, "leagueid": 14, "nationid": 12, "revision": "Transfer", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/197359.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/82.png", "attr6": "HEA 54", "attr4": "DRI 72", "attr5": "DEF 36", "attr2": "SHO 54", "attr3": "PAS 66", "attr1": "PAC 75", "foot": "Left", "weak_foot": 2, "price_xbl": 403, "rplayerid": 197359, "league": "SPL", "rare": false, "name": "Rabiu Ibrahim", "level": "silver", "defensive_work_rate": 0, "vote_sum": 1, "price_ps3": 428, "position": "CAM"}, {"rating": 66, "clubid": 155, "skill_moves": 3, "height": 177, "attack_work_rate": 2, "price_pc": 300, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/118.png", "playerid": 8995, "leagueid": 27, "nationid": 38, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/200414.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/674.png", "attr6": "HEA 46", "attr4": "DRI 74", "attr5": "DEF 46", "attr2": "SHO 55", "attr3": "PAS 61", "attr1": "PAC 77", "foot": "Right", "weak_foot": 4, "price_xbl": 327, "rplayerid": 200414, "league": "Belgium Pro League", "rare": false, "name": "Ibrahima Cont\u00e9", "level": "silver", "defensive_work_rate": 2, "vote_sum": -1, "price_ps3": 201, "position": "CAM"}, {"rating": 65, "clubid": 152, "skill_moves": 2, "height": 190, "attack_work_rate": 1, "price_pc": 200, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/136.png", "playerid": 7720, "leagueid": 27, "nationid": 13, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/192654.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/2007.png", "attr6": "HEA 67", "attr4": "DRI 39", "attr5": "DEF 65", "attr2": "SHO 35", "attr3": "PAS 56", "attr1": "PAC 32", "foot": "Right", "weak_foot": 3, "price_xbl": 244, "rplayerid": 192654, "league": "Belgium Pro League", "rare": false, "name": "Ibrahima Gueye", "level": "silver", "defensive_work_rate": 0, "vote_sum": 2, "price_ps3": 170, "position": "CB"}, {"rating": 65, "clubid": 554, "skill_moves": 2, "height": 176, "attack_work_rate": 2, "price_pc": 277, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/183.png", "playerid": 10891, "leagueid": 36, "nationid": 134, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/208923.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/112139.png", "attr6": "HEA 57", "attr4": "DRI 68", "attr5": "DEF 61", "attr2": "SHO 52", "attr3": "PAS 66", "attr1": "PAC 73", "foot": "Right", "weak_foot": 3, "price_xbl": 251, "rplayerid": 208923, "league": "Saudi League", "rare": false, "name": "Ibrahim Ghaleb", "level": "silver", "defensive_work_rate": 2, "vote_sum": 1, "price_ps3": 489, "position": "CDM"}, {"rating": 65, "clubid": 74, "skill_moves": 3, "height": 185, "attack_work_rate": 0, "price_pc": 246, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/146.png", "playerid": 3133, "leagueid": 21, "nationid": 104, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/158541.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/191.png", "attr6": "HEA 75", "attr4": "DRI 64", "attr5": "DEF 64", "attr2": "SHO 44", "attr3": "PAS 48", "attr1": "PAC 55", "foot": "Right", "weak_foot": 3, "price_xbl": 239, "rplayerid": 158541, "league": "Austrian Bundesliga", "rare": false, "name": "Ibrahim Sekagya", "level": "silver", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 303, "position": "CB"}, {"rating": 64, "clubid": 248, "skill_moves": 2, "height": 178, "attack_work_rate": 2, "price_pc": 594, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/117.png", "playerid": 8262, "leagueid": 27, "nationid": 25, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/196681.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/239.png", "attr6": "HEA 67", "attr4": "DRI 62", "attr5": "DEF 67", "attr2": "SHO 52", "attr3": "PAS 61", "attr1": "PAC 80", "foot": "Right", "weak_foot": 4, "price_xbl": 549, "rplayerid": 196681, "league": "Belgium Pro League", "rare": true, "name": "Ibrahim Ayew", "level": "bronze", "defensive_work_rate": 2, "vote_sum": 3, "price_ps3": 535, "position": "RB"}, {"rating": 64, "clubid": 558, "skill_moves": 2, "height": 178, "attack_work_rate": 0, "price_pc": 2500, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/183.png", "playerid": 10910, "leagueid": 36, "nationid": 134, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/208966.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/607.png", "attr6": "HEA 51", "attr4": "DRI 63", "attr5": "DEF 59", "attr2": "SHO 35", "attr3": "PAS 64", "attr1": "PAC 78", "foot": "Right", "weak_foot": 3, "price_xbl": 231, "rplayerid": 208966, "league": "Saudi League", "rare": true, "name": "Ibrahim Hazzazi", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 3, "price_ps3": 334, "position": "RB"}, {"rating": 62, "clubid": 561, "skill_moves": 3, "height": 180, "attack_work_rate": 1, "price_pc": 381, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/183.png", "playerid": 7465, "leagueid": 36, "nationid": 134, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/191496.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/112096.png", "attr6": "HEA 69", "attr4": "DRI 69", "attr5": "DEF 59", "attr2": "SHO 54", "attr3": "PAS 66", "attr1": "PAC 62", "foot": "Right", "weak_foot": 3, "price_xbl": 215, "rplayerid": 191496, "league": "Saudi League", "rare": true, "name": "Ibrahim Al Moghanam", "level": "bronze", "defensive_work_rate": 2, "vote_sum": 0, "price_ps3": 181, "position": "CDM"}, {"rating": 61, "clubid": 384, "skill_moves": 2, "height": 184, "attack_work_rate": 0, "price_pc": 483, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/7.png", "playerid": 10744, "leagueid": 27, "nationid": 27, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/208309.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/232.png", "attr6": "HEA 65", "attr4": "DRI 58", "attr5": "DEF 62", "attr2": "SHO 39", "attr3": "PAS 48", "attr1": "PAC 79", "foot": "Right", "weak_foot": 3, "price_xbl": 443, "rplayerid": 208309, "league": "Belgium Pro League", "rare": true, "name": "Ibrahima Ciss\u00e9", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 243, "position": "RB"}, {"rating": 60, "clubid": 26, "skill_moves": 2, "height": 180, "attack_work_rate": 0, "price_pc": 330, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/14.png", "playerid": 9093, "leagueid": 5, "nationid": 4, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/200684.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/1799.png", "attr6": "HEA 49", "attr4": "DRI 60", "attr5": "DEF 45", "attr2": "SHO 53", "attr3": "PAS 50", "attr1": "PAC 81", "foot": "Right", "weak_foot": 3, "price_xbl": 481, "rplayerid": 200684, "league": "npower Champ.", "rare": true, "name": "Ibra Sekajja", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 3, "price_ps3": 683, "position": "ST"}, {"rating": 60, "clubid": 366, "skill_moves": 2, "height": 180, "attack_work_rate": 0, "price_pc": 150, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/136.png", "playerid": 4804, "leagueid": 2, "nationid": 13, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/176485.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/1820.png", "attr6": "HEA 66", "attr4": "DRI 55", "attr5": "DEF 63", "attr2": "SHO 54", "attr3": "PAS 60", "attr1": "PAC 63", "foot": "Right", "weak_foot": 3, "price_xbl": 215, "rplayerid": 176485, "league": "Ligue 2", "rare": false, "name": "Ibrahima Ba", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 5576, "position": "CM"}, {"rating": 59, "clubid": 568, "skill_moves": 2, "height": 179, "attack_work_rate": 0, "price_pc": 175, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/183.png", "playerid": 10931, "leagueid": 36, "nationid": 134, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/209032.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/112392.png", "attr6": "HEA 56", "attr4": "DRI 50", "attr5": "DEF 59", "attr2": "SHO 37", "attr3": "PAS 57", "attr1": "PAC 81", "foot": "Left", "weak_foot": 3, "price_xbl": 245, "rplayerid": 209032, "league": "Saudi League", "rare": true, "name": "Ibrahim Madkhali", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 1, "price_ps3": 294, "position": "LB"}, {"rating": 59, "clubid": 132, "skill_moves": 2, "height": 175, "attack_work_rate": 0, "price_pc": 250, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/118.png", "playerid": 4143, "leagueid": 2, "nationid": 38, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/169800.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/1530.png", "attr6": "HEA 53", "attr4": "DRI 62", "attr5": "DEF 60", "attr2": "SHO 36", "attr3": "PAS 51", "attr1": "PAC 73", "foot": "Left", "weak_foot": 4, "price_xbl": 3634, "rplayerid": 169800, "league": "Ligue 2", "rare": false, "name": "Ibrahima Diallo", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 1646, "position": "LB"}, {"rating": 58, "clubid": 196, "skill_moves": 2, "height": 182, "attack_work_rate": 0, "price_pc": 150, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/18.png", "playerid": 917, "leagueid": 24, "nationid": 2, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/53042.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/1862.png", "attr6": "HEA 70", "attr4": "DRI 45", "attr5": "DEF 59", "attr2": "SHO 35", "attr3": "PAS 57", "attr1": "PAC 53", "foot": "Right", "weak_foot": 3, "price_xbl": 186, "rplayerid": 53042, "league": "Axpo Super League", "rare": false, "name": "Ibrahim Tall", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 847, "position": "RB"}, {"rating": 54, "clubid": 107, "skill_moves": 3, "height": 178, "attack_work_rate": 0, "price_pc": 150, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/18.png", "playerid": 10147, "leagueid": 2, "nationid": 2, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/204844.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/210.png", "attr6": "HEA 47", "attr4": "DRI 68", "attr5": "DEF 43", "attr2": "SHO 50", "attr3": "PAS 58", "attr1": "PAC 72", "foot": "Right", "weak_foot": 3, "price_xbl": 609, "rplayerid": 204844, "league": "Ligue 2", "rare": true, "name": "Ibrahima Tandia", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 343, "position": "CM"}, {"rating": 51, "clubid": 547, "skill_moves": 1, "height": 190, "attack_work_rate": 0, "price_pc": 150, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/183.png", "playerid": 10918, "leagueid": 36, "nationid": 134, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/208987.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/111674.png", "attr6": "POS 49", "attr4": "REF 51", "attr5": "SPE 42", "attr2": "HAN 43", "attr3": "KIC 44", "attr1": "DIV 59", "foot": "Right", "weak_foot": 3, "price_xbl": 158, "rplayerid": 208987, "league": "Saudi League", "rare": false, "name": "Ibrahim Zaid", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 35985, "position": "GK"}, {"rating": 51, "clubid": 570, "skill_moves": 2, "height": 176, "attack_work_rate": 0, "price_pc": 170, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/183.png", "playerid": 11240, "leagueid": 36, "nationid": 134, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/210191.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/112408.png", "attr6": "HEA 55", "attr4": "DRI 30", "attr5": "DEF 50", "attr2": "SHO 24", "attr3": "PAS 26", "attr1": "PAC 61", "foot": "Right", "weak_foot": 3, "price_xbl": 5178, "rplayerid": 210191, "league": "Saudi League", "rare": false, "name": "Ibrahim Bedhi", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 1843, "position": "CB"}, {"rating": 50, "clubid": 570, "skill_moves": 2, "height": 170, "attack_work_rate": 0, "price_pc": 200, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/183.png", "playerid": 11250, "leagueid": 36, "nationid": 134, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/210203.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/112408.png", "attr6": "HEA 48", "attr4": "DRI 52", "attr5": "DEF 46", "attr2": "SHO 40", "attr3": "PAS 51", "attr1": "PAC 74", "foot": "Right", "weak_foot": 3, "price_xbl": 588, "rplayerid": 210203, "league": "Saudi League", "rare": false, "name": "Ibrahim Joni", "level": "bronze", "defensive_work_rate": 0, "vote_sum": 0, "price_ps3": 1400, "position": "CDM"}, {"rating": 50, "clubid": 570, "skill_moves": 2, "height": 172, "attack_work_rate": 0, "price_pc": 150, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/183.png", "playerid": 11241, "leagueid": 36, "nationid": 134, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/210192.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/112408.png", "attr6": "HEA 42", "attr4": "DRI 49", "attr5": "DEF 48", "attr2": "SHO 24", "attr3": "PAS 34", "attr1": "PAC 62", "foot": "Left", "weak_foot": 3, "price_xbl": 169, "rplayerid": 210192, "league": "Saudi League", "rare": false, "name": "Ibrahim Al Zubaidi", "level": "bronze", "defensive_work_rate": 0, "vote_sum": -1, "price_ps3": 890, "position": "LB"}, {"rating": 46, "clubid": 46, "skill_moves": 2, "height": 172, "attack_work_rate": 1, "price_pc": null, "nationpicture": "http://fh13.fhcdn.com/static/img/nations/40.png", "playerid": 8916, "leagueid": 15, "nationid": 82, "revision": "", "picture": "http://fh13.fhcdn.com/static/img/players/fifa13/200101.png", "clubpicture": "http://fh13.fhcdn.com/static/img/clubs/100766.png", "attr6": "HEA 55", "attr4": "DRI 27", "attr5": "DEF 48", "attr2": "SHO 24", "attr3": "PAS 34", "attr1": "PAC 53", "foot": "Right", "weak_foot": 1, "price_xbl": null, "rplayerid": 200101, "league": "Russian League", "rare": false, "name": "Anvar Ibrahimgadzhiev", "level": "bronze", "defensive_work_rate": 1, "vote_sum": 0, "price_ps3": null, "position": "NA"}];

查看您的数据

console.log(yourData);

<强>更新 访问这样的数据

console.log(yourData[0]);

使用 for 循环来迭代数据。

答案 2 :(得分:0)

我修复了这个问题,只需在我的网站上放置一个cURL页面,该页面根据$ _GET ['term']动态删除内容;

<?php
$term = $_GET['term'];

// jSON URL which should be requested
$json_url = 'http://www.futhead.com/fifa/players/search/?term='.$term;

// jSON String for request
$data = array('term' => 'ibra');

// Initializing curl
$ch = curl_init( $json_url );

// Configuring curl options
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json')
);

// Setting curl options
curl_setopt($ch, CURLOPT_POSTFIELDS,  $data);
curl_setopt_array( $ch, $options );

// Getting results
$result =  curl_exec($ch); // Getting jSON result string

echo $result;
?>

然后我使用JSON Ajax来处理这个文件,如此

$.ajax({
                    url: "index.php",
                    dataType: "json",
                    data: {
                        term: function () { 
                            return $("#name").val() 
                    }
                    },
                    success: function(details) {
                        response($.map(details, function(item) {
                                return {
                                        label: item.rating,
                                        value: item.rating
                                }
                            }));
                    }
        });