I want to be able to make a remote data call from bloodhound using typeahead to model with codeigniter.
Make a typeahead remote call to codeigniter controller
607 Views Asked by Andres Zapata At
1
There are 1 best solutions below
Related Questions in AJAX
- Ajax jQuery firing multiple time display event for the same result
- Implement Onfailure in webApi controller
- AJAX PHP - Reload div after submit
- ajax load data from mysql
- Ajax-update only a component attribute, not the whole component nor its children
- using ajax to get a php database result and then show the result in a button
- How to prevent browser from executing some JavaScript when person clicks Back button?
- ajax async: true statement execution order
- Rails 4.2 jQuery loads only after refresh
- WebForms GET Json requests (JsonRequestBehavior.AllowGet)
- Rails - Ajax do not work properly on production server
- Angular js Button click
- Make jQuery/AJAX perform instantly on page load
- jQuery Ajax Uncaught TypeError: Cannot use 'in' operator to search
- Show success or error messages in Ajax response to Wordpress custom registration form
Related Questions in CODEIGNITER
- how to send email from localhost using codeigniter?
- CodeIgniter + XDebug: debug only working in the main controller, index() function
- Xampp redirects to /xampp
- how show result the autocomplete in the map in CodeIgniter Google Maps V3 API Library?
- Cannot use object of type stdClass as array
- Missing images after I redirect to a subdirectory using route.php and/or .htaccess in CodeIgniter Framework
- Invalid Api key using RestServer
- how to run CodeIgniter controller in cli while passing value with $_GET
- how to fetch all records from order table in Codeigniter
- How work with parked domain names in Codeigniter?
- calling mysql procedure using codeigniter [Error: result consisted more than one row]
- pass parameters in URL code igniter
- codeigniter-error on search and display data from database
- 500 error status : using angular js and codeigniter 2.2
- Select AVG in CodeIgniter
Related Questions in TYPEAHEAD.JS
- Ruby on Rails Twitter Typeahead implementation issue
- Materialize: Style of navbar search input broken when using typeahead.js (meteor)
- MVC5 Typeahead Feature
- how to reference typeahead and bloodhound when loading npm typeahead.js
- Twitter Typeahead basic example not showing popup
- typeahead.js doesn't display the dropdown using remote data
- Twitter typeahaed.js - Change query source when certain characters are hit
- twitter typeahead ajax results not all shown
- Angular directive through innerHTML in typeahead.js
- Make a typeahead remote call to codeigniter controller
- Allow typeahead,js to autocomplete words in text, instead of just single values in dropdown
- twitter typeahead create extra link in dropdown
- Bloodhound identify bug?
- AngularJS BootstrapUI Typeahead add new element if not match
- How do I specify which key to use when searching data?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
So I was struggling a bit trying to get typeahead (twitter) remote data and codeigniter to work together, I dint't find a good example that fit with my needs. After a few hours I came up with the following code, hope it helps.
The View:
The relevant part here is:
remote: { url: 'proyectos/proyectos/getProyectos?query=%QUERY', wildcard: '%QUERY' }
Where proyectos/proyectos is the controller path and getProyectos is the method that answers the request.
Whenever you type, and based on the minLength setting, is going to request a matching string in the back-end.
Note: In order to use the suggestion part in the templates setting, you must download the handlebars.js library.
The Controller:
We first get the query string from the view with $this->input->get('query') and afterwards pass it to our model.
The Model:
Here in the model we simply pass the query string to our sql select statement and we're done. The database I'm using is postgresql.
I hope you find this helpful.