I have an AJAX that runs when any of my dropdowns are changed in order to refresh data in datatables. I have this function
$("select").on('change', function() {
//get values for all checkboxes (different IDs!)
var location_city = document.getElementsByName("city_filter")[0].value;
var location_county = document.getElementsByName("county_filter")[0].value;
var location_region = document.getElementsByName("region_filter")[0].value;
var location_country = document.getElementsByName("country_filter")[0].value;
$.ajax({
url: "load_group_stores.php",
data: {
'action': 'reload_table',
'location_city': location_city,
'location_county': location_county,
'location_region': location_region,
'location_country': location_country
},
type: 'post',
success: function(result) {},
error: function() {}
});
});
and inside load_group_stores.php I try to fetch the variables in the usual way
$action = $_GET['action'];
$location_city = $_GET['location_city'];
$location_county = $_GET['location_county'];
$location_region = $_GET['location_region'];
$location_country = $_GET['location_country'];
but the results are empty. I even tried to echo the $_GET by itself
echo 'city: ' . $_GET['location_city'];
and just got a blank line. I honestly can't see what I am missing as I have multiple AJAX requests all over my site and they all work fine.
$_GET[]to$_POST[]or changetype: 'post',totype: 'GET,