Live Search Not Working! Ayuda Me! Help! |
Okay... So I'm trying to do a fancy ajax on key press search thing and I'm using CodeIgniter. All in all my code has no errors but nothing appears when I search.
*** View - home.php Code: <input name="search_data" id="search_data" class="" value="" data-label="Search for a property, a unit, or an resident..." type="text" onkeydown="ajaxSearch();" /><br> *** Controller - home.php Code: public function autocomplete() *** Model - home_model.php Code: public function get_autocomplete($search_data)
Rather than one of us going through all your code and trying to guess where the problem might be, why don't you tell us where the problem is?
You are trying to send AJAX requests to a CodeIgniter controller and perform a query, right? Does the request get sent from your page? Does the controller receive the request? Is the query being perfomed? Is the result of the query as you would expect? These are all things you should be able to answer with some simple debugging. Use the Web Console or Dev Tools of your browser to see if the AJAX request is being sent (right click -> inspect element -> network tab) Use CodeIgniter logging in your controller and model to trace the progress of the request and response. These are things you need to be able to do eventually, so you may as well start now.
Code: $this->db->select('fullname, username'); See what SQL actually is generated. If you replace the first or_like with like it might work. |
Welcome Guest, Not a member yet? Register Sign In |