autocomplete not working in ci3? |
Hi Coders,
i try many times in ci3 to work search autocomplete but im not luck. but when i try on ci2. it working good. i dont know if there is, that i need to set or to change. any help please . . .
Without more information, CI JSON support is probably not the problem. Assuming you're using AJAX POSTs, I can guess that either your CSRF protection is enabled and csrf_regenerate is set to TRUE or your sessions are now somehow interfering with your autocomplete code. If it's the former, you can either exclude your AJAX URIs in your csrf_exclude_uris setting or set csrf_regenerate to FALSE (if your application doesn't require tight CSRF protection).
Thanks for you reply. . . here are my autocomplete code.
VIEW Code: <script type="text/javascript"> Code: <input type="text" class="form-control" id="birds" value = "" name = "desc" placeholder="Required *"> CONTROLLER Code: public function search_description() MODEL Code: public function get_stocks($qs) CONFIG SETTING/CSRF Code: $config['csrf_protection'] = FALSE; I HOPE the following code above can help. couse really don't know what should i do . . . and i think my autocomplete code are not the problem.
Does the javascript console in your browser show the ajax requests going to the correct url?
What js library are you using for your autocompleter? Are you sure it's sending via GET and not POST?
What do you mean by :
Does the javascript console in your browser show the ajax requests going to the correct url? and use http://jqueryui.com/download/ jquery-ui-1.11.3.custom library . . and yes it is get not post . . .
If you're using jQuery UI, try:
Code: $("#birds").autocomplete({ I took this from my currently working autocomplete code and just added in your info so adjust it as necessary. As for the console that CroNiX mentioned, open up Chrome, right click anywhere, and open up the inspector by clicking on "Inspect Element". Click on Console and you should be able see in real-time if your JS is really reaching out to your endpoint and if it's retrieving data correctly. Place console.log(data) in your JS code if you'd like to inspect your response in the console. If you're on Firefox, try the Firebug extension. |
Welcome Guest, Not a member yet? Register Sign In |