How to change source of Struts2 autocompleter?

Clash Royale CLAN TAG#URR8PPPHow to change source of Struts2 autocompleter?
So i've made an autocompleter UI using struts2 tag. i.e "sj:autocompleter"
I need to change the source of the autocompleter on keyup. I'm giving first 100 results initially and then on keyup function i want the the source to change dynamically. How can i achieve this?
This is my autompleter tag
<sj:autocompleter name="locationName" selectBox="true"
selectBoxIcon="true"
requiredLabel=""
id="USER_NAME" autocomplete="off"
tabindex="%{session.fielddata.USER_NAME.getSearchFilterSequence()}"
label="%{session.fielddata.USER_NAME.getFieldLabel()}"
parentTheme="xhtml" labelSeparator=""
list="session.initialUserListForDropDown"
value="%{session.searchcriteria.locationName}"
cssClass="pointercursor resetfields"
style="border-radius:3px;"
maxLength="%{session.fielddata.USER_NAME.getFieldMaxValue()}">
</sj:autocompleter>
Below is the keyup function that i've binded with it
setTimeout(function(){
$(".form-group.username").find(".s2j-combobox-input.ui-autocomplete-input").keyup(function(event){
var userNameSearch= $(this).val();
if(event.which!=37 && event.which!=38 && event.which!=39 && event.which!=40 && event.which!=13)
{
var options_USER_NAME_widget = {};
options_USER_NAME_widget.hiddenid = "USER_NAME";
options_USER_NAME_widget.selectBox = true;
options_USER_NAME_widget.selectBoxIcon = true;
options_USER_NAME_widget.forceValidOption = true;
options_USER_NAME_widget.jqueryaction = "autocompleter";
options_USER_NAME_widget.id = "USER_NAME_widget";
options_USER_NAME_widget.name = "locationName_widget";
options_USER_NAME_widget.href = "applicationURL+"searchUserNameValues"+"?"+"userNameSearch"=userNameSearch
jQuery.struts2_jquery_ui.bind(jQuery('#USER_NAME_widget'),options_USER_NAME_widget);
}
});
},1000);
This is my JSON
{"searchedUserNames":["","admin","abcd","undertaker","hellya","ohno","grand","supp","oimate","cmom","sgray","jlambregtse","ssantana","jharris","cmanroy","lololo","abhi","bc","mc","di","admin1","admin2","admin3","adm2in","yoyo","BackendUser","hello"]}
This JSON is getting stored in the select as a string as it is .. What am i doing wrong? How can i get it work?
I've also tried to set the source via blow code but it didn't work
$(".form-group.username").find(".s2j-combobox-input ui-autocomplete-input").autocomplete( "option", "source", list );
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.