Tokeninput 插件:- 更改 ajax 请求 URL
我正在从特定 URL 检索数据,但为了收到正确的结果,我需要删除参数。
当前由令牌输入生成的 URL 为:-
http://developer.echonest.com/api/v4/artist/suggest?api_key=W8ZWNWH6N&name=radiohead&_=1320665341820
我需要删除最后一部分:-
& _=1320665341820
我怎样才能实现这一点,以便令牌输入只生成一个具有以下内容的 URL格式:-
http://developer.echonest.com/ api/v4/artist/suggest?api_key=W8ZWNWH6N&name=radiohead
我当前的“令牌输入”初始化代码是:-
$("#similar_artists").tokenInput("http://developer.echonest.com/api/v4/artist/suggest?api_key=W8ZWEXAMPLEWH6N", {
hintText: "Please begin typing the name of a famous artist who has the kind of sound you are looking for. You may select as many as you wish.",
theme: "facebook",
onAdd: function (item) {
filterDatatable();
},
onDelete: function (item) {
filterDatatable();
},
searchDelay: "0",
tokenDelimiter: ", ",
animateDropdown: true,
preventDuplicates: true,
deleteText: "",
tokenValue: "name",
crossDomain: false,
tokenLimit: "6",
queryParam: "name",
noResultsText: "There are no valid artists that match your request, please try again.",
onResult: function (data) {
return data['response']['artists'];
}
});
});
I am retrieving data from a specific URL but in order to recieve the correct results I need to remove a paramater.
The URL currently being generated by token input is:-
http://developer.echonest.com/api/v4/artist/suggest?api_key=W8ZWNWH6N&name=radiohead&_=1320665341820
I need to remove the last part :-
&_=1320665341820
How can I achieve this so that token input just generates a URL with the following format:-
http://developer.echonest.com/api/v4/artist/suggest?api_key=W8ZWNWH6N&name=radiohead
My current initialization code for 'Token input' is:-
$("#similar_artists").tokenInput("http://developer.echonest.com/api/v4/artist/suggest?api_key=W8ZWEXAMPLEWH6N", {
hintText: "Please begin typing the name of a famous artist who has the kind of sound you are looking for. You may select as many as you wish.",
theme: "facebook",
onAdd: function (item) {
filterDatatable();
},
onDelete: function (item) {
filterDatatable();
},
searchDelay: "0",
tokenDelimiter: ", ",
animateDropdown: true,
preventDuplicates: true,
deleteText: "",
tokenValue: "name",
crossDomain: false,
tokenLimit: "6",
queryParam: "name",
noResultsText: "There are no valid artists that match your request, please try again.",
onResult: function (data) {
return data['response']['artists'];
}
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论