Hi everyone,
I’m using Yii 1.1.14 and I have a little problem with Ajax w/ POST method.
Well, i’m using a
CHtml::ajaxLink('', Yii::app()->createUrl( 'controller/action' ),
array( // ajaxOptions
'type' => 'POST',
'data' => array('user_id'=>$user_id,'object_type'=>$object_type,'object_id'=>$object_id),
'success' => 'function() {
$(".watch_off").hide();
$(".watch_on").show();
}',
'error' => 'function(exception){
console.log(exception);
}',
),
)
and works fine in my pc (localhost) where I’m using a WAMP solution w/ PHP 5.4.12
On the webserver, where I have a PHP 5.4.45, I have a problem. The script works correctly, because when the action is called the script is really run on db [I can explain you by saying that there is a status On/Off to change…], but I get 403 Forbidden status! And the consequence is that the success function doesn’t run, of course.
I would add another information: there isn’t any mistake in the access rules definition on my controller file (in fact script works!).
By adding the “error” parameter, to catch exception, I don’t get too much on my console: exception is an object, not a message to read.
I’ve also tried
console.log(exception.stack)
but gives me "undefined".
Any ideas? Suggestions?
Thanks