1

私はこのシンプルなWebサービスを持っています

<WebMethod()> _
 Public Function HelloWorld() As String
    Return "[1255545454545,4]"
 End Function

これはクライアント側になります>

      $.ajax({
          type: "POST",
          url: "WebService1.asmx/HelloWorld",
          data: "{}",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function(response) {
              alert(response);
          },
          failure: function(msg) {
              alert(msg);
          }
      });
  });

取得した[オブジェクトオブジェクト]の代わりに実際の値を取得するにはどうすればよいですか

4

1 に答える 1

4

response.dにアクセスしてみてください。これはAsp.Netの機能です。

$.ajax({
      type: "POST",
      url: "WebService1.asmx/HelloWorld",
      data: "{}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(response) {
          alert(response.d);
          alert(response.d[0]);
          alert(JSON.stringify(response));
      },
      failure: function(msg) {
          alert(msg);      
      }
  });

http://encosia.com/never-worry-about-asp-net-ajaxs-d-again/

于 2012-04-23T20:37:51.917 に答える