[eluser]Fielder[/eluser]
I've been hacking away at this all day and searching manuals and forums... still stuck (although I've found a work-around by NOT using a controller/function url).
*Consider all javascripts properly loaded and view setup correctly*
My jQuery is
Code:
$("#storeAutoSuggest").autocomplete("/rtui/codeigniter/index.php/storeform/autocompletestore");
The jQuery plugin documents
Quote:For remote data: When the user starts typing, a request is send to the specified backend ("my_autocomplete_backend.php"), with a GET parameter named q that contains the current value of the input box and a parameter "limit" with the value specified for the max option.
A value of "foo" would result in this request url: my_autocomplete_backend.php?q=foo&limit=10
So in my storeform/autocompletestore controller, I have
Code:
function AutoCompleteStore()
{
//TODO:: does not function with jquery autocomplete. When loading storeform/autocompletestore it does not see the "q" variable in the url
$q = strtolower($_GET['q']);
if (!$q) return;
$items = array(
"Green Heron"=>"Butorides virescens",
"Solitary Sandpiper"=>"Tringa solitaria",
"Heuglin's Gull"=>"Larus heuglini"
);
foreach ($items as $key=>$value) {
if (strpos(strtolower($key), $q) !== false) {
echo "$key|$value\n";
}
}
}
I get "ERROR undefined index: q".
I know the jQuery and my form view works, because instead of loading the controller/function as I want above, if I simply load an external .php
<like this>
Code:
$("#storeAutoSuggest").autocomplete("/rtui/codeigniter/system/application/views/include/search.php");
with the exact same code in my function - it DOES work.
But I want to be able to manage the array, data, and database query calls from inside my controller.
Any thoughts?