Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带有jquery.TokenInput的JSON解析器(格式)_Javascript_Jquery_Json - Fatal编程技术网

Javascript 带有jquery.TokenInput的JSON解析器(格式)

Javascript 带有jquery.TokenInput的JSON解析器(格式),javascript,jquery,json,Javascript,Jquery,Json,我对jquery.tokenInput有问题 这是我的输入代码: $(".search-betrocket").tokenInput("http://www.websitehere.com/web/search", { searchDelay: 2000, minChars: 3, tokenLimit: 5, hintText: "Buscador inteligente...", noResultsText: "Sin resultados",

我对jquery.tokenInput有问题

这是我的输入代码:

$(".search-betrocket").tokenInput("http://www.websitehere.com/web/search", {

    searchDelay: 2000,
    minChars: 3,
    tokenLimit: 5,
    hintText: "Buscador inteligente...",
    noResultsText: "Sin resultados",
    searchingText: "Buscando...",
    theme: "facebook",
    queryParam: "txt",
    propertyToSearch: "NickName",

    resultsFormatter: function(item){ return "<li>" + "<img src='" + Users.Avatar + "' title='" + item.first_name + " " + item.last_name + "' height='25px' width='25px' />" + "<div style='display: inline-block; padding-left: 10px;'><div class='full_name'>" + item.first_name + " " + item.last_name + "</div><div class='email'>" + item.email + "</div></div></li>" },

    tokenFormatter: function(item) { return "<li><p>" + item.first_name + " <b style='color: red'>" + item.last_name + "</b></p></li>" }
});
问题在于如何导航json对象以正常工作。 Ie通过$val['Users']['0']['Nickname']格式输入,但使用jquery/json

有人帮我吗?

如果你的json是

[{Id:1, NickName:xxxx, Avatar: "19b452bf3fe83e17de82b67e518361d2", Ranking: 3233}]
然后

$.each(data, function(a, b) {

    alert (b.Id);
    alert (b.NickName);
    alert (b.Avatar);
    alert (b.Ranking);

});

你有什么错误?另外,这是您网站JSON输出的直接副本吗?如果是,则无效。JSON要求用双引号包装键名:Mmmmmm抱歉JAAulde这不是我的JSON这是de问题,我不知道这个JSON是jquery格式的。这是我的JSON{用户:[{Id:264,昵称:SirBet,头像:19b452bf3fe83e17de82b67e518361d2,排名:3233,名:先生,姓:Bettor,性别:H,地点:巴伦西亚,描述:Acepto todo tipo de retos:,国家Id:1,国家:España,CountryISO:ES,PrivacyUpdate:0}
$.each(data, function(a, b) {

    alert (b.Id);
    alert (b.NickName);
    alert (b.Avatar);
    alert (b.Ranking);

});