I'm trying to insert some data into mySQL database using AJAX and jQuery $.post. My attempt to test the functionality is as follows
index.html: code fragment (already using jQuery for many other functions)
$.post(
"updateDatabase.php",
{ name: "Zara" },
function(data) {
//$('#stage').html(data);
alert('Success');
}
);
updateDatabase.php
<?php
if( $_REQUEST["name"] ) {
$name = $_REQUEST['name'];
echo "Welcome ". $name;
echo "<script>alert('Im here')</script>";
}
?>
What I'm getting is an alert with "Success" and nothing else(It is the callback function of $.post). I already researched a lot and found some similar but different questions. However my problem left unsolved because there is no satisfactory solution for this particular issue.