hi i am using Ajax AutoComplete for jQuery
in my jquery i am using
options = { serviceUrl: "<? echo $this->config->item('base_url'); ?>index.php/welcome/autocomplete" };
a = $('#query').autocomplete(options);
i saw that i can pass extra parameters like
var a = $('#query').autocomplete({
serviceUrl:'service/autocomplete.ashx',
minChars:2,
delimiter: /(,|;)\s*/, // regex or character
maxHeight:400,
width:300,
zIndex: 9999,
deferRequestBy: 0, //miliseconds
params: { country:'Yes' }, //aditional parameters
noCache: false, //default is false, set to true to disable caching
// callback function:
onSelect: function(value, data){ alert('You selected: ' + value + ', ' + data); },
// local autosugest options:
lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values
});
so i want to create n new parameter and pass it like this
var a = $('#query2').autocomplete({
serviceUrl: "<? echo $this->config->item('base_url'); ?>index.php/welcome/autocomplete",
id:'query2'
});
How can i access that extra parameter from the autocomplete code ?? i want to add that id to my
.autocomplete-w1
initially it looks like this
<div class="autocomplete-w1"></div>
i want to change it to
<div id="jquery2" class="autocomplete-w1"></div>
please help................................
UPDATE
i tried to adding my id parameter to this function
function Autocomplete(el, options) {
this.el = $(el);
this.el.attr('autocomplete', 'off');
this.suggestions = [];
this.data = [];
this.badQueries = [];
this.selectedIndex = -1;
this.currentValue = this.el.val();
this.intervalId = 0;
this.cachedResponse = [];
this.onChangeInterval = null;
this.ignoreValueChange = false;
this.serviceUrl = options.serviceUrl;
this.isLocal = false;
this.options = {
autoSubmit: false,
minChars: 1,
maxHeight: 300,
deferRequestBy: 0,
width: 0,
highlight: true,
params: {},
fnFormatResult: fnFormatResult,
delimiter: null,
zIndex: 9999,
id:'test'
};
this.initialize();
this.setOptions(options);
}
i gave a default value test . when i alert $this.options.id i always getting 'test' the value i passig jquery2 is not getting . what is the problem there ????