Passing GET value into function |
[eluser]alboyd[/eluser]
I feel like an idiot but please tell me what I am doing wrong? THis is soooo frustrating! I need to use GET for a JQUERY autocompleter. I am sending URL base_url/controller_name/function_name?q=Al and function function_name() { $get_val = $this->input->get('q'); echo $get_val; die(); } I get a blank page! What's up with that?? please help thanks
[eluser]TheFuzzy0ne[/eluser]
Do you have query strings enabled? If so, I thought the syntax needed to be something like - http://your_site.tld/?c=controller_name&m=method&q=Al
[eluser]alboyd[/eluser]
Thanks that improves the situation - however now I get a response Disallowed Key Characters from the autocompleter
[eluser]Dam1an[/eluser]
There are a few threads on jQuery and autocomplete on the forums, maybe reading through them will give some pointers in the right direction http://ellislab.com/forums/viewthread/113567/ http://ellislab.com/forums/viewthread/110744/ http://ellislab.com/forums/viewthread/103357/ http://ellislab.com/forums/viewthread/90604/ Hope these help
[eluser]alboyd[/eluser]
That's awesome thanks heaps! Found the revised autocomplete code which users function params instead of GET. Much better thanks!! Now I just have to figure out why the auto-complete isn't inside my inputbox!
[eluser]Evil Wizard[/eluser]
if you are using the JQuery autocomplete you just attach it to an id Code: $('#myinput').autocomplete('/url/to/autocomplete');
[eluser]coding_hero[/eluser]
If you are talking about this jQuery autocomplete: http://www.devbridge.com/projects/autocomplete/jquery/ Then all you have to do is change the $.get() call to $.post() on line 222, and use $this->input->post('query') in CodeIgniter. If you're using a different jQuery library, then somewhere in there they likely make a $.get or $(this).get() call, and you can usually replace that with 'post' and be ok. The $.get() and $.post() functions both take the same parameters. |
Welcome Guest, Not a member yet? Register Sign In |