Fucking fuck fuck

This commit is contained in:
Karl Cordes 2011-05-02 09:42:35 +10:00
parent 0757962b8c
commit fdee1dd0df
3 changed files with 18 additions and 2 deletions

View file

@ -37,6 +37,8 @@ class ShipmentsController extends AppController {
function ajax_edit() {
$this->layout = 'ajax';
if(!empty($this->data)) {
$this->Shipment->create();
if ($this->Shipment->save($this->data)) {
echo "SUCCESS";
}
@ -48,12 +50,26 @@ class ShipmentsController extends AppController {
}
else {
echo "NO-DATA";
return;
}
}
function ajax_add() {
$this->layout = 'ajax';
$this->Shipment->create();
if ($this->Shipment->save($this->data)) {
echo "SUCCESS";
}
else {
echo "FAILURE";
}
}
/* Moved the Views for Adding/Editing to elements. Called from the Index.
*

View file

View file

@ -13,7 +13,7 @@ $(function() {
"New Shipment": function() {
var thisShipmentInputs = $('#ShipmentAddForm').find('input,select,textarea');
$.post('/shipments/ajax_edit', thisShipmentInputs, function(data) {
$.post('/shipments/ajax_add', thisShipmentInputs, function(data) {
$( "#dialog-form" ).dialog('close');
//window.location.reload(); //Change this to fetch a new copy of the table and update a <div>.
});