Click here to Skip to main content
15,901,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I'm fairly new to jQuery and have used Autocomplete against a Zip-code database.
I'm trying a slightly more sophisticated job where I need an additional parameter, an accountID to run with the back end stored procedure. It seems pretty simple, but when I debug my aspx page, the URL parameter accID is coming as undefined.

Any help with where I'm going wrong setting the value of this parameter?

Thanks!! P

JavaScript
<script type="text/javascript">
    $(document).ready(function() {
    var accID = $("#<%=txtHiddenAcctNum.ClientID%>").val();
    $("#<%=txtForwardTo.ClientID%>").autocomplete('AddressBookHandler.ashx?accID=' + accID);
});
</script>
Posted
Updated 21-Nov-11 9:52am
v3

1 solution

I think you should do something like this.

JavaScript
$("#<%=txtForwardTo.ClientID%>").autocomplete('AddressBookHandler.ashx', {
   extraParams: {
       accID: function() { return $("#<%txtHiddenAcctNum.ClientID%>").val(); }
   }
});


Hopefully that helps or puts you on a path that helps. I got this example from Auto Complete help. If you go there you will be able to find more out about the auto complete function.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900