I am using AJAX to send values to PHP and retrieve the values from PHP. The problem is the value i am getting from PHP is viewed as undefined in AJAX. Please help me solve this
Because you are encoding your data in json.
Try adding dataType:"json"
in your ajax and ajax has type
not method so change to type
data should be in {}
only:
$.ajax({
type:"GET",
url:"dash2.php",
dataType: 'json',
data:{channel:channel},
success:function(data){
console.log(data.a);
console.log(data.b);
console.log(data.c);
}
});
Try putting this line:
$channel=$_GET['channel'];
after db selection:
mysql_select_db($dbname);