Asp.net 访问javascript文件中的json
大家好,我是asp.net的初学者,我的aspx页面中有以下Json:Asp.net 访问javascript文件中的json,asp.net,Asp.net,大家好,我是asp.net的初学者,我的aspx页面中有以下Json: { { "Status":"<%= this._result.ToString().ToLower() %>" , "SavePath":"<%= this.FileUrl%>" , "FileName":"<%= this.Request["qqfile"] %>", "SizeError":"<%= t
{
{
"Status":"<%= this._result.ToString().ToLower() %>" ,
"SavePath":"<%= this.FileUrl%>" ,
"FileName":"<%= this.Request["qqfile"] %>",
"SizeError":"<%= this._sizeError.ToString().ToLower()%>",
"ImgValidation":"<%=this._Imgvalid.ToString().ToLower()%>"
}
}
如何使用json坦克
简而言之,您的JSON无效。你有
{
{
"Status":"<%= this._result.ToString().ToLower() %>" ,
"SavePath":"<%= this.FileUrl%>" ,
"FileName":"<%= this.Request["qqfile"] %>",
"SizeError":"<%= this._sizeError.ToString().ToLower()%>",
"ImgValidation":"<%=this._Imgvalid.ToString().ToLower()%>"
}
}
{
{
“状态”:“状态”,
“保存路径”:“”,
“文件名”:“,
“SizeError”:“,
“ImgValidation”:”
}
}
但应该是这样
{
"Status":"<%= this._result.ToString().ToLower() %>" ,
"SavePath":"<%= this.FileUrl%>" ,
"FileName":"<%= this.Request["qqfile"] %>",
"SizeError":"<%= this._sizeError.ToString().ToLower()%>",
"ImgValidation":"<%=this._Imgvalid.ToString().ToLower()%>"
}
{
“状态”:“状态”,
“保存路径”:“”,
“文件名”:“,
“SizeError”:“,
“ImgValidation”:”
}
然后您可以将属性引用为responseJSON.Status、responseJSON.SavePath等。
JSON对象就是一个对象。如果该对象没有名称,您如何引用它?有效的是
{
JSONResponse:{
"Status":"<%= this._result.ToString().ToLower() %>" ,
"SavePath":"<%= this.FileUrl%>" ,
"FileName":"<%= this.Request["qqfile"] %>",
"SizeError":"<%= this._sizeError.ToString().ToLower()%>",
"ImgValidation":"<%=this._Imgvalid.ToString().ToLower()%>"
}
}
{
JSONResponse:{
“状态”:“状态”,
“保存路径”:“”,
“文件名”:“,
“SizeError”:“,
“ImgValidation”:”
}
}
你说的“使用json”是什么意思?当您执行responseJSON.status时,您已经在使用它。您的JSON一开始就无效。你的括号嵌套得太深了。您无法引用“状态”,因为您无法引用持有“状态”的对象。
{
JSONResponse:{
"Status":"<%= this._result.ToString().ToLower() %>" ,
"SavePath":"<%= this.FileUrl%>" ,
"FileName":"<%= this.Request["qqfile"] %>",
"SizeError":"<%= this._sizeError.ToString().ToLower()%>",
"ImgValidation":"<%=this._Imgvalid.ToString().ToLower()%>"
}
}