I cannot seem to get data from an array using the $.ajax()
function. I am displaying a failure message when access the data name.
$.ajax({
method: "POST",
url: "update.php",
data: { content: $("#textbox").val()}
})
.done(function( msg ) {
alert( "Data Saved: " + msg );
});
The above code works but when the code in update.php is not pulling the msg and triggering Failure
<?php
if(array_key_exists('content', $_POST)){
echo "Success";
} else {
echo "Failure";
}
?>
the name: 'content'
should display the content in #textbox
but it does not.