Hello. Guys, I’m probably a bit closed). In general, if you start typing text into a search on this site (Bosch, for example), a block appears below, offering search results. How is this implemented? Interested in client part
Thank you in advance!
Hello. Guys, I’m probably a bit closed). In general, if you start typing text into a search on this site (Bosch, for example), a block appears below, offering search results. How is this implemented? Interested in client part
Thank you in advance!
Such a thing can be implemented on jQuery and php + MySQL . Everything works very simply, we send a request through jQuery , process it through php and get a response.
This can be roughly done like this:
html:
Create an input and output response line
<input type='text' name='text' id='text'> <div id='mess'></div>
jQuery:
$(document).ready(function(){ $('#text').keyup(function(){ $.post('php_check.php',{name: $('#text').val()}, function(data){ $('#mess').text(data); }); }); });
php:
Processing request
<?php $name = $_POST['name']; $row = mysql_fetch_array(mysql_query("SELECT * FROM table WHERE name='$name'")); echo $row['name']; ?>
Well, something like this, the code still needs to be upgraded, but the technology is so :)
Judging by the connected scripts and styles, this is jQuery Autocomplete .
Source: https://ru.stackoverflow.com/questions/199089/
All Articles