php - AJAX live search not working properly -
picture:
my ajax live search working right having 1 problem. when enter 'c' shows me result in c character occurs. when click 'ce' no search shows when have word 'certificate'. don't know why happening. appreciated.
is there way highlight particular word when moving mouse on it? , when clicked word, should put in input box?
php:
<?php $getaccount = $_get['getaccountinput']; if($getaccount != '') { $query = oci_parse($con, "select distinct account_type accounts account_type '%".$getaccount."%'"); oci_execute($query); $r = oci_fetch_array($query); if(empty($r)) { echo "no result found"; } while($row = oci_fetch_array($query)) { echo "<a href='#'>"; echo '<font color="white">'.$row['account_type'].'</font>'; echo '<br>'; echo "<div style='border: 1px solid #aaaaaa; margin-left: -4px'></div>"; echo "</a>"; } } ?>
js:
$("#changeaccountinput").on('input', function() { var getaccountinput = document.getelementbyid("changeaccountinput").value; $.ajax ({ type: 'get', url: 'reports/account search.php', data: 'getaccountinput='+getaccountinput, success: function(data) { $('#results').html(data); } }); });
i used below code return clicked value outputing values in search
like:
s sss dss esdsds
i get: sssdssesdsds
$('#results').click(function() { var a=$(this).text(); alert(a); });
Comments
Post a Comment