我有jquery在 order/my-cart
我试图从 order/delivery-verify
. 我的javascript如下
$('form#Confirm').submit(function(event){
event.stopPropagation();
event.preventDefault();
Core.ajax({
type: "GET",
dataType: "json",
url: "/order/delivery-verify",
data: $(this).serialize(),
success: function (result) {
if (typeof (result.status) != 'undefined') {
if (result.status == 200) {
window.location.href = '/order/checkout';
} else {
Core.handleInvalidServerResponse(result);
}
}
}
});
})
这个脚本在 subdomain.example.com
但在另一台服务器上却抛出403错误 subdomain.example-one.com
编辑OrderController.php
<?php
namespace frontend\controllers;
use common\components\CErrorAction;
use common\helpers\Com;
use frontend\components\CController;
use frontend\models\User;
use yii;
use frontend\models\Configuration;
use yii\helpers\Json;
use yii\helpers\ArrayHelper;
use frontend\models\Order;
use common\helpers\Mailer;
use frontend\models\NewsletterSubscriber;
/**
* Class SiteController
* @package frontend\controllers
*/
class OrderController extends CController
{
/**
* @return array
*/
public function actions()
{
return [
'error' => [
'class' => CErrorAction::class
],
];
}
/**
*
* @return type Json
* @Title("Checkout verify")
*/
public function actionDeliveryVerify()
{
.....
}
......
}
public function accessRules()
{
return array(
array(
'allow',
'actions'=>array('delivery-verify'),
'users'=>array('*'),
)
);
}
尝试添加 accessRules()
的控制器中。上述代码允许任何用户访问 delivery-verify
动作。
请按照下面的链接获取Yii1.1的官方API文档:-。Yii1.1 CController- Yii1.1 CA访问控制过滤器- 认证和授权