警告ajax响应

时间:2014-06-26 15:08:16

标签: php jquery ajax codeigniter

我正在尝试在codeigniter中读取ajax请求的响应,但现在不能这样做,我尝试了很多方法,但是失败了(stringify,console.log)

向其发送ajax请求的控制器

function func()
{
    echo json_encode("a");
}

ajax请求

$.ajax({
    type: "POST",
    url: "<?php echo base_url(); ?>/index.php/file/func",
    data: {},
    success: function(result){
        //how to alert "a" here??????
    },
});

请帮助

1 个答案:

答案 0 :(得分:0)

json_encode代替json_encoded

更改://how to alert "a" here????? 致:alert(result);