I\'m trying to send back multiple variables from a php file to ajax using json in an array. The code in the php file works perfectly and does everything with my database lik
I believe if you use dataType you should be using contentType, "The official Internet media type for JSON is application/json".
.ajax(
{
url: 'UpdateComments.php',
type: 'POST',
contentType: "application/json",//note the contentType defintion
dataType: "json",
data:
{
type: "add",
comment: $("#comment").val(),
id: videoID
},
success: function (data)
{
//Get the data variables from json and display them on page
}
});