【发布时间】:2015-03-03 19:58:16
【问题描述】:
我正在尝试使用 cakephp 中的 ajax 调用访问数据,但出现 403 禁止错误,如下所示。
GET http://localhost/ec/bazar/Products/color_switcher/3
403 (Forbidden)
jquery.js:6
x.ajaxTransport.sendjquery.js:6
x.extend.ajax53:251
colorSwitcher53:327
onclick
我正在使用此代码拨打电话
function colorSwitcher(id){
var testid = id;
$.ajax({
type: 'GET',
url: '<?php echo $this->webroot; ?>Products/color_switcher/' + testid,
error: function () {
console.log("error in ajax call");
},
success: function (data) {
$("#img-portion").html(data);
},
});
}
控制器
public function color_switcher($testid = ''){
$this->layout= 'ajax';
}
color_switcher.ctp
<?php echo "helooooooo"; ?>
【问题讨论】: