Autocomplete and passing dynamic parameters
The below code works fine using jQuery UI 1.8 and jQuery 1.4.2
$("#sid_entry_box").autocomplete({
source:"autocomplete_sid.php?database="+database_name,
minLength:4,
delay:1000,
enable:true,
cacheLength:1
});
The database name is passed as a parameter to receive the php call.
This app has two databases selected by radio buttons. Since jQuery loads and assigns this function when the document is loaded, the database name is all that has been checked so far.
I really need to pass the php call:
database=$("input[name=rf_database_option]:checked").val();
Is there an easy way to understand the dynamic value of the dom?
a source to share
Puaka's solution works. Thanks!
However, it seems to me that in autocomplete there should be a path to read in any DOM value, and then pass that parameter to autocomplete, which in turn is passed to the php get routine.
Imagine you need to grab 10 different parameters from the DOM. This becomes a hassle for entering and changing 10 callback functions, each of which adds the ability to autocomplete.
Hopefully future jQuery documentation will show more examples of using the various autocomplete options.
a source to share