Skip to content

Instantly share code, notes, and snippets.

@natecavanaugh
Forked from longfalcon/gist:5628303
Last active December 17, 2015 14:59
Show Gist options
  • Save natecavanaugh/5628413 to your computer and use it in GitHub Desktop.
Save natecavanaugh/5628413 to your computer and use it in GitHub Desktop.
AUI().use("autocomplete", "autocomplete-highlighters", "aui-io-request", function (A) {
A.one('#<portlet:namespace/>academyName').plug(A.Plugin.AutoComplete, {
resultHighlighter: 'phraseMatch',
resultListLocator: 'orgs',
resultTextLocator: 'name',
queryDelimiter: ',',
minQueryLength: 3,
source: function(query) {
var queryUrl = '<%=searchUrl%>&<portlet:namespace />keywords=' + query + '&<portlet:namespace/>types=' + types;
var request = A.io.request(
queryUrl,
{
data: {
keywords: query,
types: types
},
sync: true,
dataType: 'json',
method: 'POST'
on: {
success: function(event, id, obj) {
console.log("SUCCESS");
callback(this.get('responseData'));
}
}
}
);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment