{"user":{"@id":"10","firstName":"Bill","lastName":"Clinton"}}
Here is the JavaScript code:
var ws_url = 'http://example.webservice.com:8002/xxx-ws/management/usr/10';
$.ajax({
url: ws_url,
dataType: 'json',
timeout : 5000,
}).success(function( data, textStatus, xhr ) {
alert( "returned user name = " + data.user.firstName + " " + data.user.lastName );
gdata = data;
}).error(function(httpObj, textStatus) {
alert(textStatus);
alert(JSON.stringify(httpObj));
});
You will get [returned user name = Bill Clinton]
No comments:
Post a Comment