如何更改 jQuery 自动完成插件默认查询字符串键?(我想要的术语) [英] how to change jQuery autocomplete plugin default querystring key? (term to that i want)

查看:11
本文介绍了如何更改 jQuery 自动完成插件默认查询字符串键?(我想要的术语)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery 自动完成插件发送这样的请求

jQuery autocomplete plugin sent request like this

mysite.com/suggestion?term=Sadegh

有什么方法可以将 term 查询字符串键更改为另一个键吗?我找不到为我提供此选项的选项;)

is there any way to change term querystring key to another? i can't find option that provide this for me ;)

推荐答案

我假设您正在使用 jQuery UI 自动完成

I assume you're using jQuery UI AutoComplete

您需要提供回调作为源,如下所示:

You need to provide a callback as the source, like this:

$(...).autocomplete({
    source: function(term, callback) {
        $.getJSON("url", { foo: term }, callback);
    }
});

这篇关于如何更改 jQuery 自动完成插件默认查询字符串键?(我想要的术语)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆