[jQuery] Using AutoCompleter, how do you pass parameters
I'm using a modification of Dylan Verheul's AutoCompleter that can be
found at http://www.pengoworks.com/workshop/jquery/autocomplete.htm.
I need to pass not only the user's input, but the customer number. On
a full hit, I know it from the logged in user, on an AJAX call I need
another way to determine it. Perhaps there is a better/easier way,
but I was just going to put the customer number in a hidden form field
and then pass it via the AJAX call.
So I have this form field:
<input type=hidden id="CustNo" name="CustNo" value="791823">
The AutoComplete section of the JavaScript is:
$(document).ready(function() {
$("#txtItem").autocomplete("itemquery.abc?&CustNo="+$
('#CustNo').val(),
{
delay:10,
minChars:2,
matchSubset:1,
matchContains:1,
cacheLength:10,
maxItemsToShow:15,
width:500,
onItemSelect:selectItem,
onFindValue:findValue,
formatItem:formatItem,
autoFill:true
}
);
But then the QueryString as seen on the backend is:
CustNo=791623?q=12
Normally what I see on the back end would be more like:
CustNo=791623&q=12
and I could extract the customer number with no problem. Actually, I
still can, however I'd like the query string to be built properly so
that it's:
q=12&CustNo=791623
I'm very new to JQuery. Can I make this work?
Thanks.