0
A
回答
7
我所知,你可以返回XML或JSON。
要返回JSON添加此註釋或你的方法:
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
並在您的類允許ScriptService
[ScriptService]
一個例子:
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public Dictionary<string, object> Test()
{
var ret = new Dictionary<string, object>();
ret.Add("Test", 1);
return ret;
}
// result:
{d:{Test:1}}
相關問題
- 1. ASP.NET WEBMETHOD總是返回401
- 2. asp.net webmethod是否總是返回jsonified數據?
- 3. My.Computer.Name是否總是返回大寫?
- 4. PayPal是否總是返回payer_id?
- 5. 對XSD XML驗證總是返回true
- 6. 是GooglePlayServicesAvailable總是返回2
- 7. Hazelcast總是返回null,containsKey總是返回false
- 8. 是否有可能從WebMethod返回一個html表?
- 9. 從asmx webmethod調用返回xml?
- 10. PHP CURL總是返回空
- 11. 'GetProcessIdOfThread'總是返回零
- 12. TFS API:GetLocalWorkspaceInfo總是返回空
- 13. 總是返回零值
- 14. pcntl_wifexited總是返回true
- 15. getorientation()返回o.o總是
- 16. Request.IsAjaxRequest()總是返回false
- 17. 三通總是返回EINVAL
- 18. datatable.rows.count總是返回0
- 19. VisualStateManager.GoToState總是返回false
- 20. InputStream總是返回nullpointerexception
- 21. HttpContext.Current.User.IsInRole(roleName)總是返回false
- 22. getUser總是返回0
- 23. DataTable總是返回空值
- 24. ExecuteScalar()總是返回NULL
- 25. PHChange changeDetailsForFetchResult - 總是返回零
- 26. SCOPE_IDENTITY()總是返回0
- 27. 總是返回英語
- 28. AFNetworking 2.0總是返回403
- 29. CacheManager.getCacheFileBaseDir()總是返回空
- 30. Nsdate總是返回空