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
616 Views Asked by Andres Zapata At
1
There are 1 best solutions below
Related Questions in AJAX
- window.location.href redirects but is causing problems on the webpage
- Js variable to php using ajax
- TypeError: Failed to execute 'arrayBuffer' on 'Blob': Illegal invocation - Insert blob into database
- how do I change a URL with form to include additional selection
- why i have to put extra space in before write option selected because it show error if i don't ' option:selected'
- Opening modal through Update button with specified ID using ajax
- Events disappear randomly for full calendar module
- Ajax call reloads page in FrontAccounting, a PHP ERP solution
- Add newly added record to select2 element
- AJAX query cascading dropdown in django
- Failed to load resource: the server responded with a status of 403 () - SCRIPT - WordPress
- Maintaining search and sort state across paginated results in web application
- Getting POST 500 Internal server error while sending request via ajax call
- Wordpress server side datatable filtering
- Having a problem in datatables and fullcalendar scripts
Related Questions in CODEIGNITER
- Overlay text on image not renedered correctly when using custom hindi font with GD library functions
- PHP CodeIGniter 3
- domPdf is showing blank page
- Is there a way to create connection pooling in codeigniter 3 using custom mysqli driver?
- Codeigniter 4 - MySQL Duplicate Entry exception not working
- How can I reconfigure CodeIgniter (v4) to serve with a new sub-directory path (via nginx)?
- How to logout with public function
- How to autoload a user-defined class in CI4?
- passing object to a view within a foreach loop in CodeIgniter
- Function in controller does not receive data from ajax on button [SOLVED]
- Create REST API Endpoints from an Existing PHP CodeIgniter Project
- Message: Invalid argument supplied for foreach() while using foreach
- CodeIgniter 4 migration fails but the equivalent MySQL query does not
- CodeIgniter 4 with hmvc
- Zend Barcode label distance ajustment
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.