I am trying to read the response of ajax request in codeigniter, but couldn't do so uptill now, I have tried to many ways, but failed (stringify, console.log)
controller to which ajax request is sent
function func()
{
echo json_encode("a");
}
ajax request
$.ajax({
type: "POST",
url: "<?php echo base_url(); ?>/index.php/file/func",
data: {},
success: function(result){
//how to alert "a" here??????
},
});
help please
It is json_encode
instead of json_encoded
and
change: //how to alert "a" here?????
to: alert(result);