那你好。我有这个问题,我无法弄清楚dateTimePicker的语法错误。请帮助这里是
中的表格<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>
这是我的功能:
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);
}
});
}
这是我的ajax页面:
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';
}
如果你可以帮助我,那将非常感激。提前致谢。
答案 0 :(得分:0)
我发现问题就是这一行
$updateExpDate = "UPDATE lu_product_link SET (link_promo_expiry) = '".$datePicker."' WHERE link_id = '".$hidid."'";
(link_promo_expiry)不应该在()
中