File: /var/www/selfanalyse/wp-content/plugins/psychometrics/api/get_city.php
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type');
include_once('../../../../wp-config.php');
$PSY_CITY = $wpdb->prefix . PSY_CITY;
$state_id = $_REQUEST['state'];
$cities = $wpdb->get_results("SELECT * from $PSY_CITY where state_id='$state_id'");
echo $citi = '<option value="0">^^Select City^^</option> ';
foreach ($cities as $ct) {
?>
<option value="<?php echo $ct->city_id ?>"><?php echo $ct->city_name ?></option>
<?php
}