I am trying to get my db rows from php. Currently the js success function isn't being reached. Is there anything obvious in the php that may be causing an issue?
The php
$id=$_GET['id'];
$stmt = $db->prepare("SELECT * FROM brand_members WHERE Id = :id");
$stmt->bindValue(':id',$id,PDO::PARAM_INT);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($result);
The js
$.ajax({
url: 'dead.php', //the script to call to get data
data: "id=8",
dataType: 'json', //data format
success: function(data) //on recieve of reply
{
var id = data[0]; //get id
var vname = data[1]; //get name
alert("a"); //get name
}
});