4,250
社区成员
发帖
与我相关
我的任务
分享<script type="text/javascript">
$(document).ready(function() {
loadPage("data_view", "<?php echo $this->baseUrl . $this->list_url ?>");
});
function saveData() {
if (false == isValid()) return false;
$("#op").addClass("loader").append("Saving......");
$.post('<?php echo "$this->baseUrl/ModuleName/ControllerName/ActionName"; ?>',
{id: $('#id').val(), cover_by: $('#cover_by').val(), from_date: $('#from_date').val(), end_date: $('#end_date').val()},
function() {
$("#from_date").val("");
$("#end_date").val("");
$("#cover_by").val("");
$("#op").removeClass("loader").empty();
}
);
}
</script>
public function saveAction() {
//如果你使用了Zend的Layout功能一定要加上这句关闭布局
$this->_helper->layout->disableLayout();
//如果页面中有中文需要显示,则要加上这句
header('Content-Type:text/html; charset=GB2312');
$id = trim($this->getRequest()->getParam("id"));
$cover_by = trim($this->getRequest()->getParam("cover_by"));
$from_date = trim($this->getRequest()->getParam("from_date"));
$end_date = trim($this->getRequest()->getParam("end_date"));
$row = array("login_name" => $this->user->login_name, "from_date" => $from_date, "end_date" => $end_date, "cover_by" => $cover_by);
if ("" == $id) {
$this->getManagement()->insert($row);
}
else {
$this->getManagement()->update($id, $row);
}
echo "Save Successful.";
}