JS档案
"delete" : function() {
calEvent.id = id;
id++;
calEvent.start = new Date(startField.val());
calEvent.end = new Date(endField.val());
calEvent.title = titleField.val();
calEvent.body = bodyField.val();
//post to events.php
$.post( "events.php", { action: "del", id: calEvent.id });
$calendar.weekCalendar("removeEvent", calEvent.id);
$dialogContent.dialog("close");
}
将发送ID发送到events.php,而不是发送到events.php句柄接收ID
<?php
$action = $_POST['action'];
if (!$link = mysql_connect('host', 'user', 'pass')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('agenda', $link)) {
echo 'Could not select database';
exit;
}
if ($action == 'del')
{
$id = $_POST['id'];
$del = "DELETE FROM meeting_rooms_calendar WHERE id='$id'";
$result = mysql_query($del, $link);
}
?>
从数据库中删除,但它不会在数据库中删除我的数组。 我做错了什么?