Skip to content

Instantly share code, notes, and snippets.

@longfalcon
Created May 22, 2013 15:06
Show Gist options
  • Save longfalcon/5628303 to your computer and use it in GitHub Desktop.
Save longfalcon/5628303 to your computer and use it in GitHub Desktop.
AUI().use("autocomplete", "autocomplete-highlighters", 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 = AUI().io(
queryUrl,
{
data: {
keywords: query,
types: types
},
sync: true,
dataType: 'json',
method: 'POST'
/*on: {
success: function(event, id, obj) {
console.log("SUCCESS");
callback(obj.responseText);
}
}*/
}
);
console.log("SUCCESS");
return request.responseText;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment