【发布时间】:2017-11-01 13:39:46
【问题描述】:
我在 Javascript 文件中有一个 Json 文件和一个 ajax 调用。尝试使用 Hello World asmx 文件模板编写正确的 Web 服务方法。我应该在方法中写什么才能使其在网站上显示/返回/读取 json 数据?
$(document).ready(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://localhost:56537/WebService.asmx/HelloWorld",
data: "{}",
dataType: "json",
success: function (Result) {
debugger;
Result = Result.d;
var data = [];
var dataResource = response
【问题讨论】:
-
您仍然可以创建 ASMX Web 服务,但 Microsoft 已经不再支持它了。最好使用 WCF 服务应用程序。您可以使用 DataContractJsonSerilizer。
-
感谢您的提示!
标签: asp.net json ajax web-services asmx