jquery-autocomplete
jquery-autocomplete copied to clipboard
Problem with extraParams
Hi there !
I've got a problem I can't solve by myself, I've already try to search on the web without succeed... so I finally post here !
Here is my code :
$("#search_city").autocomplete({
url: '/ajax/get_city.php',
minChars: 3,
extraParams: {
dept: function() { return $("#search_dept option:selected").val(); }
},
mustMatch: false
});
When I try to get the value of $_GET["dept"] in my php script "get_city.php" I've got the entire code : "function() { return $("#search_dept option:selected").val(); }" as a string instead of the real value of this field !
Do you have any idea of what append to my script ?
Thanx a lot for your help! Boo
PS : sorry if my english isn't perfect, I did my best...:-)
You can modify the makeUrlParam function like this:
var makeUrlParam = function(name, value) {
if(value != 'undefined' && value != '' && jQuery.isFunction(value))
{
value = value();
}
return [name, encodeURIComponent(value)].join('=');
};