ive read some questions related to my question but i can't find a solution
in some part of my website. posting a single value to a php page works
so i searched passing multiple values using ajax and applied it to my website but i says posting failed
this is the php code. i tried running it to my server by passing directly a data to the php and it works like this $temp1 = "0001" this is the inserdocument.php file
$temp1 = $_POST['dtnum'];
$temp2 = $_POST['ddoctitle'];
$temp3 = $_POST['ddoctype'];
$temp4 = $_POST['ddoccontent'];
$temp5 = $_POST['ddocdatefilled'];
$stmt = $conn->prepare("CALL sp_insertdocument (?,?,?,?,?)");
$stmt->bindParam(1, $temp1, PDO::PARAM_STR, 30);
$stmt->bindParam(2, $temp2, PDO::PARAM_STR, 50);
$stmt->bindParam(3, $temp3, PDO::PARAM_STR, 50);
$stmt->bindParam(4, $temp4, PDO::PARAM_STR, 10);
$stmt->bindParam(5, $temp5, PDO::PARAM_STR, 10);
$stmt->execute();
and this is my ajax code. i even tried adding try and catch but the catch returns nothing.
$.ajax({
type: "POST",
url: "inserdocument.php",
data: ({dtnum: tnum, ddoctitle: doctitle, ddoctype: doctype, ddoccontent: doccontent, ddocdatefilled: docdatefilled})
})
.done(function (msg) {
alert("Data Saved: " + msg);
//$('#response').html(msg);
})
.fail(function() {
alert( "Posting failed." );
});