我尝试了以下查询。
当我通过devtools看到答案时,会看到以下内容:
{状态:正确,信息:[,…],旁遮普语:[4786.6,4677.4],…} 状态:真实 信息:[,…] punitorios:[4786.6,4677.4]
但是我不能执行代码,应该为真执行:
$.post('/buscarCuotas',{_token:_token,dni:dni},function(data){
if(data.status === true)
{
.....
这是什么原因?我尝试在.post的末尾添加'json',但无效
答案 0 :(得分:0)
我认为,如果您需要获取JSON数据,则需要序列化响应,或者为了使用更新的代码,可以在可以使用
的地方使用fetch
fetch('URL',
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(dataForTheServer))
.then(response => response.json())
.then(data => {
if(data.status === true)
{
...
}
}).catch(errorHandler)