Yep. In my experience, I think the only time I found it not to send
any extra param is if the value of the param is empty (or undefined, I
believe).
In the example, if:
   $("#country").val();
returns nothing.


pragard,
You might want to try to test it with a hard-coded value:
   extraParams: {
       country: function() { return 'USA'; }
   }

On Oct 1, 3:13 pm, MorningZ <morni...@gmail.com> wrote:
> First off, you should use Firefox and Firebug (or Chrome/Safari with
> their respective Developer Consoles) to look at the URL That the
> autocomplete call actually calls...
>
> the "extraParams" get appended onto the URL as a query string value...
> there's no reason why $_GET wouldn't work to get the value unless you
> have something coded incorrectly
>
> On Oct 1, 9:10 pm, Otniel Zebua <otn...@gmail.com> wrote:
>
> > Thanks for your replies.
>
> > I know that in the example, there is a server-side code called "search.php"
> > that list all of the autocomplete list. And in that files the words that we
> > type was get by $_GET['q'].
> > Now my problem is, as I mentioned before, that it can pass the country ID
> > with extra params, but how do I get the country ID in the "search.php" files
> > so I can list all my city based on the country that I choose? What parameter
> > did the server-side code get for the country ID. I have try $_POST and $_GET
> > and got nothing.
>
> > If I use the example I mentioned before
> > "
> > $("#states").autocomplete(url, {
> >     extraParams: {
> >        country: function() { return $("#country").val(); }
> >    }
> > "
> > what parameter should I get in the server-side code?
>
> > I'm sorry Jack, because I'm really new in javascript :D
> > Once again thanks for your help.
>
> > Regards,
>
> > On Fri, Oct 2, 2009 at 2:12 AM, James <james.gp....@gmail.com> wrote:
>
> > > I don't see what the problem is and what you want help on. You have
> > > the code right there that essentially does what you want.
> > > You just have to build the server-side code to select only cities with
> > > the selected country and a match to the autocomplete text.
> > > ... or did you want someone to build all of that for you?
>
> > > On Oct 1, 6:41 am, pragard <otn...@gmail.com> wrote:
> > > > Hi, i'm trying the jquery autocomplete from here
>
> > > >http://docs.jquery.com/Plugins/Autocomplete
>
> > > > On that page someone said that:
> > > > "
> > > > Often one autocompleted field depends on the value of another field.
> > > > In that case, the extraParams option can provide the necessary dynamic
> > > > parameter:
>
> > > > Consider an example where the states-field reuses the value entered
> > > > into the country field
> > > > "
>
> > > > And the examples was:
> > > > "
> > > > $("#states").autocomplete(url, {
> > > >    extraParams: {
> > > >        country: function() { return $("#country").val(); }
> > > >    }
> > > > "
>
> > > > What I'm trying to do is I made a combo box that contain country with
> > > > it's id, and I also have a input text that will do the autocomplete.
> > > > If I select one of the country from the combo box, I want input text
> > > > will show me, when I press some words with autocomplete function, all
> > > > of the city that include in that country (assuming I have it in my
> > > > database).
>
> > > > What should I do? Can someone give me some examples?
>
> > > > Thanks.
>
>

Reply via email to