我有jquery.tokenInput的问题。JSON解析器与jquery.TokenInput(格式)
这是我的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>" }
});
问题是去解析... jQuery的了解不多,以了解JSON解析器返回的对象。
这是我的代码JSON结果_ GET请求
{
Users: [
{
Id: 264,
NickName: "SirBet",
Avatar: "19b452bf3fe83e17de82b67e518361d2",
Ranking: 3233,
FirstName: "Sir",
LastName: "Bettor",
Gender: "H",
Location: "Valencia",
Description: "Acepto todo tipo de retos :)",
CountryId: 1,
Country: "España",
CountryISO: "ES",
PrivacyUpdated: 0
}
]
}
什么也不是如何导航JSON对象才能正常工作。 即通过输入$ val ['Users'] ['0'] ['Nickname'] format但jquery/json。
有人帮我吗?
你什么错误?另外,是从您的网站的JSON输出的直接副本?如果是这样,它是无效的。 JSON要求使用双引号括起键名:''' – JAAulde