I am using Ajax to save textarea conent in database:
$("#update").click(function(e) {
e.preventDefault();
var ttle = $("#title").val();
var text = $("#prjdesc").val();
var dataString = 'param='+text+'¶m1='+ttle;
$.ajax({
type:'POST',
data:dataString,
url:'insert.php',
success:function(data) {
alert(data);
}
});
});
insert.php:
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$name = $_POST['param'];
$title = $_POST['param1'];
$sql="INSERT INTO $tbl_name (title, content) VALUES ('$name','$title')";
if(mysql_query($sql)) {
echo "Success";
} else {
echo "Cannot Insert";
}
I am alerting success message when data is successfully saved. I need to know how to displayed on another page when the data is successfully saved.
How is this done?