Using jquery ajax with Post method I have a code like
var col = senario +"_"+eTraget;
var data='column='+col;
$.ajax({
type:"POST",
url:"con/data.php",
data:data,
dataType: 'json',
success: function (html) {
coords = html;
console.log(data);
})
now as you can see I used the console.log(data); and it print the result like column=ce_3000
in the console but in PHP file I have nothing in Array()!
<?php
define ( 'DB_HOST', 'localhost' );
define ( 'DB_USER', 'root' );
define ( 'DB_PASS', 'root' );
define ( 'DB_NAME', 'test' );
$col = $_POST['column'];
$con = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME);
$query = "SELECT x, y FROM ecoloprojects WHERE". $col."=1";
print_r($_POST);
$con->close();
?>
I tried to printr the POST array but it is empty can you please let me know why this is happening?
Update:
Try this in the JS instead: