Well hello there. I have this problem where I can't figure out where the syntax error is with my dateTimePicker. please help here is the form its in
<form name="subExpdate" method="POST" action="" id="subExpdate" >
<input type="date" id="expDatePicker" name="expDatePicker" style="margin-bottom: 5px" >
<input type="hidden" value="<?php echo $prodLink->valueof('link_id') ?>" id="hidID" name="hidID">
<input type="hidden" name="prodInt" id="prodInt" value="<?php echo $selInterface; ?>"/>
<button class="btn btn-success" type="button" name="changeExpireDate" id="changeExpireDate" onclick="changeExpireDate23()" >Change expire date</button>
</form>
Here is my function:
function changeExpireDate23() {
var expTime = new FormData(document.getElementById('subExpdate'));
console.log('something' + expTime);
$.ajax({
url: "my path and it works not allowed to show",
type: 'POST',
data:expTime,
contentType: false,
processData: false,
success: function (data) {
alert(data);
console.log(data);
}
});
}
and here is my ajax page :
if (isset($_POST['expDatePicker'])){
$datePicker = date('d/m/Y H:i:s' , strtotime($_POST['expDatePicker']));
$getLinkData = new CGenRs("SELECT * FROM lu_product_link WHERE link_id = '" . $hidid . "' ", $cao_beta2);
$getLinkData->first();
$updateExpDate = "UPDATE lu_product_link SET (link_promo_expiry) = '".$datePicker."' WHERE link_id = '".$hidid."'";
if($cao_beta2->execute($updateExpDate)){
echo 'SUCCESS date updated';
} else{
echo 'Failed sorry mate';
}
please if you can help me it would be much appreciated. thanks in advance.