There is a window for dialing the city. How to ensure that when typing letters of a city, cities from a database to these letters are automatically loaded via ajax and drop out a list of these cities in the choices block as in a google search?

<input id="city" name="city"> <div class="variants"></div> 

Js

 $('input').on('input', function(e) { /*что здесь делать*/ }); 

Php

 function city(Request $request) { $abc= $request->input('city'); $allcities=DB::table('city')->all(); //что дальше } 
  • Have you tried to send a request ? - br3t
  • one
    And how many cities in the database? If up to 10,000 I would immediately upload everything to the page, if hundreds of thousands, then through an appeal to the server. - Nsk
  • Cities of the Russian Federation only - Artur Han
  • developers.google.com/maps/documentation/javascript/… - I would advise you to use a turnkey solution, I see no point in making new bikes in this case. - Nikita Loshenin

0