thinkphp5 ajax调用后端始终进入error
js代码:
$.ajax({
type : "GET",
async:"false",
contentType: "application/json;charset=UTF-8",
url : "/api/",
success : function(result) {
},
error : function(e){
alert('error');
}
});
TP5代码:
public function api(){
$ret = $this->getScan();
return $ret
}