-7

In a jQuery Ajax call to an ASP.NET page method like so:

function getUsers() {
      $.ajax({
          type: "POST",
          url: "http://{localhost}:8078/Default.aspx/GetJson2",
          data: "{}",
          contentType: "application/json",
          dataType: "json",
          success:  function (msg) {
              $("#Result").text(msg.d)
          }
      )};

the data returned from the server is inside a property .d of the msg even though my CLR object has no such property. Why is this?

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
Karthik Dheeraj
  • 1,039
  • 1
  • 13
  • 25
  • 6
    I'll just leave it here: http://api.jquery.com/ – zerkms May 23 '13 at 11:44
  • I've edited the question to reflect what OP said in comments about the intent of the question, but that makes it a duplicate of http://stackoverflow.com/questions/10263916/why-does-web-service-return-data-as-msg-d – Stephen Kennedy Jun 06 '15 at 12:32

2 Answers2

2

It's placing the value of msg.d as text into the element with an id of Result

Joseph
  • 117,725
  • 30
  • 181
  • 234
1

getUsers is sending an ajax request to http://{localhost}:8078/Default.aspx/GetJson2 and receiving a json string which JQuery is automatically parsing into a javascript object (msg). Then the 'd' property of this object is inserted as text into the DOM element with an id of "Result"

Rob Johnstone
  • 1,704
  • 9
  • 14