Tokeninput 插件:- 更改 ajax 请求 URL

发布于 2024-12-13 19:53:48 字数 1522 浏览 3 评论 0原文

我正在从特定 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文