When making a request, I typically use the following method:
$.ajax({
url: myUrl,
type:"GET",
dataType: "json",
success: callback
});
After forming a JSON string on the server side, I send it to the client which looks like this:
"{'composers':
{'composer':
{
'id':2,
'firstName': 'Arcangelo',
'lastName': 'Corelli'
}
},
{'composer':
{
'id':7,
'firstName': 'Antonio',
'lastName': 'Vivaldi'
}
}
}"
For some reason, nothing seems to be received on the client side! However, using XML format instead of JSON works perfectly fine! The content type is set as follows:
response.setContentType("application/json");