10 javascript asp.net arrays jquery json
我偶然发现了一个小问题.我得到一个JSON响应,其中包含一个包含67615个条目的字节数组.现在它增加了一个
`[....,154,156,);jQuery1910039778258679286416_1363006432850(181,104,...]
Run Code Online (Sandbox Code Playgroud)
每个~7300个字符
现在,当我使用ajax方法解析它如何正常工作时,它给出了一个错误,因为回调使元素列表后的响应无效SyntaxError:missing]
...,184,1,26,65,140,86,211,16,194,210,174,1); jQuery17203250109862964784_13639643449 ...
所以它不再有效
我用它来解析它
$.ajax({
url : url,
cache : false,
dataType : "jsonp",
crossDomain : true,
success : function(root) {
console.log(root)
}
})
Run Code Online (Sandbox Code Playgroud)
这可能是asp服务器给我对象的问题还是解析有问题?
提前致谢
EDIT1:
[WebMethod(Description = " ", EnableSession = true)]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public Borrower getSessionedBorrowerHeader(ref sysmessage aMessage)
{
if (!(userValidated(ref aMessage)))
return null;
BorrowerControl borrowerControl = new BorrowerControl(LOCALconnectionStringDb,
WEBconnectionStringDb,
STATSconnectionStringDb,
LIBconnectionStringDb,
CATconnectionStringDb,
LIBconnectionStringDb,
Session);
Borrower returnObj = borrowerControl.getSessionedBorrowerHeader(ref aMessage);
borrowerControl.Dispose();
return returnObj;
}
Run Code Online (Sandbox Code Playgroud)
如果你需要更多的代码告诉我我不进入ASP :(
EDIT2:
怎么做:(这是JSON的答案
根据 jQuery 文档,您可以设置 jsonp 回调的名称,以在您的情况下节省字节:jsonpCallback
function J() { ... }
$.ajax({
url : url,
cache : false,
dataType : "jsonp",
jsonpCallback : "J",
crossDomain : true,
success : function(root) {
console.log(root)
}
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
816 次 |
| 最近记录: |