我遇到以下问题:如果我在开发环境中提出AJAX请求,则会得到以下(缩写)原始结果:
{
"id": 37988,
"technique_id": 20,
"task_area_id": 1,
"task_area_name": "Gestao",
"order": 3,
"text": 437,
"unscheduled": 0,
"start_date": "17-10-2018",
"hours": 4,
"adjusted_hours": 4,
"done_hours": 0,
"duration": 1,
"progress": null,
"status": null,
"worker": 53,
"priority": 1,
"parent": 236,
"readonly": 0,
"cancreate": 0
},
另一方面,当我在产品环境中调用它时:
{
"id": "37988",
"technique_id": "20",
"task_area_id": "1",
"task_area_name": "Gest\u00e3o",
"order": "3",
"text": "437",
"unscheduled": "0",
"start_date": "17-10-2018",
"hours": "4",
"adjusted_hours": "4",
"done_hours": "0",
"duration": "1",
"progress": null,
"status": null,
"worker": "53",
"priority": "1",
"parent": "236",
"readonly": "0",
"cancreate": "0"
},
请注意,我的prot int值已转换为字符串。 代码相同,数据库相同。
数据库调用也相同,在两种情况下,数字都以int形式返回,那么为什么在一种情况下保留int格式而在另一种情况下将其转换为字符串呢?
有人知道为什么会这样吗?
谢谢!
答案 0 :(得分:0)
从task_area_name \ u00e中可以看到-它具有不同的格式(编码)。
问题可能出在请求标头或网络服务器配置中。
答案 1 :(得分:0)
使用以下
JSON.stringify(obj);