I have this stadard code for receiving a class from a web service:
function getStuff() {
var callParams = "{'param1':'" + "oren" + "'}"
$.ajax({
type: "POST",
url: "http://192.168.5.223:8989/TolunaAPI.asmx/GetDummyType",
data: callParams,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert(data);
....
This give an alert that says: [object Object].
I tried reading some related posts here and on JQuery documentation, but I can't understand what exactly is the "data" object.
What the web service returns is and object named DummyType:
public class DummyType
{
public ErrorTypes error;
public NestedDummyType nested;
public DummyType() { }
public DummyType(string paramName)
{
error = ErrorTypes.None;
nested = new NestedDummyType();
}
}
}
Which as you see has another object in it, namely NestedDummyType:
public class NestedDummyType
{
public string nestedString;
public int nestedInt;
public NestedDummyType()
{
nestedString = "Hello from nested";
nestedInt = -1;
}
}
All of these are supposed to be returned in json format, but as mentioned, I can't seem to be able to interpret the received data.
How is this done?
Thanks.