<select onchange="getval(this);" name="city" id="city" required>
<option value="1">один</option>
<option value="2">два</option>
</select>
function getval(sel)
{
let city = sel.value;
let data = {
city_id : city
};
$.ajax({
type: "POST",
url: "city.php?city=???",
data: data,
success: function(html){
$("#pz").load('city.php?city=???');
}
});
};
function getval(sel)
{
let city = sel.value;
let data = {
city_id : city
};
$.ajax({
type: "POST",
url: `city.php?city=${city}`,
data: data,
success: function(html){
$("#pz").load(`city.php?city=${city}`);
}
});
};
function getval(sel)
{
let city = sel.value;
let data = {
city: city
};
$.ajax({
type: "GET",
url: 'city.php',
data: data,
success: function(html){
$("#pz").load(`city.php?city=${city}`);
}
});
};
<select onchange="getval(this);" name="city" id="city" required>
<option value="1">один</option>
<option value="2">два</option>
</select>
async function getval(sel) {
var city = encodeURIComponent(sel.value);
var response = await (await fetch('/city.php?city=' + city)).text();
alert("Запрос успешно отправлен, ответ сервера:\n" + response);
}