![]() |
Keyup function doesn't work - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1) +--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3) +--- Thread: Keyup function doesn't work (/showthread.php?tid=82412) |
Keyup function doesn't work - meryemb - 07-07-2022 This script work perfectly on procedural, but in ci4, 'keyup' function doesn't work ? <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script> $(document).ready(function() { $("#search").keyup(function() { $.ajax({ url: 'backend.php', type: 'post', data: {search: $(this).val()}, success: function(result) { $("#result").html(result); } }); }); }); </script> Is there somebody would like to help me please.. ? RE: Keyup function doesn't work - InsiteFX - 07-08-2022 CodeIgniter url is [ controller/method ]. Code: <script> RE: Keyup function doesn't work - meryemb - 07-11-2022 [quote pid="398183" dateline="1657349768"] Thanks dude, its work, but something else happens. The #inputSearch called (showed up) twice ? [/quote] [quote pid="398183" dateline="1657349768"] I'm sorry but I need your solutions again ? [/quote] RE: Keyup function doesn't work - InsiteFX - 07-12-2022 Post your new code here so that we can see it. RE: Keyup function doesn't work - meryemb - 07-13-2022 I'm sorry but I still use my own code, I just follow ur instructions to use ci url to controller/method <form action="" method="post"> <div class="container mt-2"> <div class="row g-2"> <div class="input-group input-group-sm mb-2"> <input type="text" class="form-control" id="cari" name="cari" placeholder="search city or region.." maxlength="16" size="35%"> <button class="btn btn-success" type="button" name="search" id="search"">Submit</button> </div> <hr class="mb-0"> <div class="row" name="result" id="result"></div> <hr class="mb-0"> <small class="text-muted mt-0 pt-0">Made with ? <a href="/">CodeIgniter</a></small> </div> </div> </form> When I click submit, this whole form appears again below the result div between <hr class="mb-0"> RE: Keyup function doesn't work - ignitedcms - 07-16-2022 Just to add to the above, it's not a good idea to do a round trip to the server on keydown, look into 'debouncing' if that is your intended behaviour. |