Displaying 1 result from an estimated 1 matches for "expand_uri".
Did you mean:
expand_arg
2006 Aug 23
0
Ajax.Autocompleter method and URIs
...completer("suggest", "suggest_choices", "/suggest/{query}");
This way, people can put the query anywhere in the URI that they want,
rather than forcing them to adopt a particular implementation strategy.
The nice thing about this is that the code is really easy;
expand_uri: function (uri, params) {
var vars = uri.match(/{[^}]+}/g);
if (! vars) return uri;
for (var v=0; v < vars.length; v++) {
var name = /{([^}]+)}/.exec(vars[v])[1];
var value = params[name];
var search = new RegExp("{" + name +...