Live search with ajax |
Hi
I've been looking for a tutorial on how to make a live user search with CI4 but I haven't found anything useful on the net. I am creating a backend with CI4 and on the user management page I have a search input which I want to be a live search with ajax where I can start typing a name and it shows me suggestions. Has anybody done this with CI4? I'd appreciate if anybody could share their ideas or some code snippets. ![]()
There are many ways to do that, what did you use normally?
You could just modified it a little for ci4 or maybe no need to modify it and just use it, depend on the code. maybe share some example of what you usually use here so I can see?
This is what I've come up with so far:
Controller: PHP Code: public function userList() View: Code: <input type="text" id="autouser" class="form-control" placeholder="fullname"> JS: Code: $(document).ready(function(){ It actually works and suggests the list of users and shows the id of the selected user. The only issue I have now is the drop-down style:
well for the style, just style it using css or inline style if you want(
![]() From your picture I guest it use <ul> <li> as the dropdown list for the suggestion. So just give it a class or inspect it to easier understanding of the tag used and style it. Or if you want to use jqueryUI autocomplete they already have theme in their package.
Here's a live search I wrote a long time ago, source supplied. It should be applied t,o Codeigniter quite easily:
http://johns-jokes.com/downloads/sp-e/jb-ajax-search/
Thanks for the info, I also want to try writing this search with an ajax. I think it should be processed faster
If you need a help with essay writing help, use - https://bestresearchpaper.com/
|
Welcome Guest, Not a member yet? Register Sign In |