Jquery autocomplete does not always work -


i've been using code autocomplete input. in many cases code works fine, in doesn't. relates ios user, android user, windows 7, 8, 10 user, chrome , firefox.

availabetags includes 13500 listings.

thanks ;)

$( "#tags" ).autocomplete({   minlength: 3,   delay: 100,   autofocus: false,   source: function (request, response) {   var term = $.ui.autocomplete.escaperegex(request.term)             , startswithmatcher = new regexp("^" + term, "i")             , startswith = $.grep(availabletags, function(value) {                 return startswithmatcher.test(value.label || value.value || value);             })             , containsmatcher = new regexp(term, "i")             , contains = $.grep(availabletags, function (value) {                 return $.inarray(value, startswith) < 0 &&                     containsmatcher.test(value.label || value.value || value);             });          response(startswith.concat(contains));     },   focus: function(event, ui) {     $( "#tags" ).val(ui.item.value);     return false;   },   select: function(event, ui) {     $( "#{/literal}{$plzid}{literal}" ).val(ui.item.plz);     $( "#{/literal}{$blid}{literal}" ).val(ui.item.bl);     return false;   }                           }); 

i think better can use php handle datas displayed in inout field

php code:

search.php

<?php require 'config.php'; $key = $_get["term"]; $query = "select * students name '%$key%'"; $result = mysqli_query($con,$query); while($ser=mysqli_fetch_assoc($result)){     $data[] = $ser["name"]; } echo json_encode($data); ?> 

jquery code here:

<script> $(function(){ $("#name").autocomplete({   source:'search.php'   }); }); </script> <input type="text" id="name"> 

note: dont't forgot add jquery ui plugin


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -