[英]What will my JSON array look like?
I am making a ajax call, and the backend is gonig to return a JSON array. 我正在进行ajax调用,后端是gonig以返回JSON数组。
Can someone give me an example of what my json array should look like so I can do the following in javascript? 有人可以给我一个我的json数组看起来如何的示例,以便我可以在javascript中执行以下操作吗?
if(myJSON.ErrorCode == 100)
{
alert(myJSON.Response.Message);
for(var x = 0; x < myJSON.Response.Values.Count; x++)
alert(myJSON.Response.Values[x];
}
else
{
if(myJSON.ErrorCode == 250)
{
alert(myJSON.ErrorMessage);
}
}
First case: 第一种情况:
{ ErrorCode: 100, Response: { Message : "some message", Values : [0, 1, 2, ... ] } }
Second case: 第二种情况:
{ ErrorCode: 250, ErrorMessage: "error message" }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.