i’m trying to update a the field of a cakePHP model through a jquery request.
eventhough the ajax call is a success , the model isn’t updated on the database .
<?php $Url = Router::url(array('controller'=>'coupons','action'=>'update_statut'),true); ?>
$.post('<?php echo $Url ?>', { id: id},function(data)
{ alert("sucess");
}).error(function() { alert("error"); })
.complete(function() { alert("complete"); });
on the controller’s side here’s the action :
function update_statut(){
Configure::write('debug', 0);
$this->autoRender = false;
if($this->RequestHandler->isAjax()) {
$this->Coupon->id= $this->params['form']['id'];
$this->Coupon->saveField('statut','terminé');
}
i even hardcoded the id in the action to make sure it fits with my table row.
any suggestions
you might wanna check out if you u’ve done
might be the condition