What\'s my function\'s problem? I want to read the response from my webservice but I just receive an error.
The browser message is:
undefined-
It seems like your webservice only responds with plain text, while the jQuery request expects JSON in return.
JSON is a format that lets you send different datatypes (strings, integers, arrays, etc.) in a coherent manner. Note 18 on this page shows you a typical JSON response for a person listing.
Your response should look something like:
{"companyName": "Foobar Inc."}
And, if I'm not mistaken, your onSuccess function should be something along the lines of:
function OnSuccess(data, status) {
SetMainBody(data.companyName);
}
Now I'm not entirely sure about the jQuery function, but your response is definitely not JSON! :-)