Welcome Guest, Not a member yet? Register   Sign In
jquery with autocomplete extra parameter problem
#1

[eluser]imn.codeartist[/eluser]
Hi All,

I really needed help here if any one can help me out.

I have one select box and one text box and I need to pass the value of select box when auto complete starts.

Please HELP HELP HELP
#2

[eluser]jdfwarrior[/eluser]
I'm assuming you mean you need to pass two parameters to the auto completer?
#3

[eluser]imn.codeartist[/eluser]
Yes .. Can you please help..
#4

[eluser]jdfwarrior[/eluser]
I'm assuming your using a plugin to do the auto completion.. Since I dont know how what your plugin in specific is written to do, I'll just explain whats more than likely going on and you may end up wanting to just write your own auto completer because its really simple.

Basically (hope you understand most of this), jQuery is grabbing the data from that text field when its changed and using the AJAX functionality built into jQuery to post that data to a php script that searches for the data, and then throws back a result that is shown on the page.

The $.post command accepts a function or script name as the first parameter, the data to pass as the second parameter, then a callback function. An auto completer also just adds the functionality of, when you click on one of those results, it grabs that value and sticks it in the box. You either need to find a way pass the second parameter to your auto completer, or modify the plugin. Modifying may prevent it from working correctly in other areas of the site if reused though. You could also make your own to do what you want, and just add the click events and all. Really isnt a hard process. Link in my sig for ajax post would get you started. Otherwise, look through documentation for the plugin and see if there is a way to pass multiple objects.




Theme © iAndrew 2016 - Forum software by © MyBB