My php script echoes
Connection successful{"name":"James","dateOfBirth":"2002-10-10","companyname":"Apple"}
using
echo json_encode(array('name'=>$row['Name'], 'dateOfBirth'=>$row['dateOfBirth'], 'companyname'=>$row['companyname']));
In Javascript the different values should then be displayed in a Label, but the Labels return undefined
$(function() {
$.ajax({
type: "post",
url: 'url',
data: {usermail: 42},
success: function(response){
nameLabel.innerHTML = response.name;
dateLabel.innerHTML = response.dateOfBirth;
companyLabel.innerHTML = response.companyname;
console.log(response);
}
});
});
Via Active questions tagged javascript - Stack Overflow https://ift.tt/yfEC4AD
Comments
Post a Comment