![]() |
autocomplete not working in ci3? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: autocomplete not working in ci3? (/showthread.php?tid=1251) |
autocomplete not working in ci3? - jaysondotp - 02-23-2015 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 . . . RE: autocomplete not working in ci3? - jaysondotp - 02-23-2015 i dont know if json is working well on CI3? RE: autocomplete not working in ci3? - Nichiren - 02-23-2015 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). RE: autocomplete not working in ci3? - jaysondotp - 02-23-2015 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. RE: autocomplete not working in ci3? - CroNiX - 02-23-2015 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? RE: autocomplete not working in ci3? - jaysondotp - 02-23-2015 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 . . . RE: autocomplete not working in ci3? - Nichiren - 02-25-2015 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. |