On the site a list of cities
<li class="post_btn">Москва</li>
The user clicks on a specific city and this value is sent by post-request to the server. Task: as soon as the server receives a new value, there is a selection from the base, taking into account the new city. On the site in the field "Your city .." the value of the city changes and the plate of offers for this city is displayed.
if (isset($_POST["city"])) { $city = $_POST["city"]; select_db_function(); }
Here is how the data is sent:
$(document).ready(function(){ $(".post_btn").click(function() { city= $(this).text(); $.post("/lending2/index.php", {city: city}); }); });
But the site does not make any changes. The select_db_function()
function itself is working, because when a city is sent via an input
form, everything works. I can not understand what the problem is, I ask for help.