次GetArray.jsp
の形式の配列を出力する with Java コードがあります。
[{"value":"Hi","id":"77","label":"Hi there"},
{"value":"Hello","id":"21","label":"Hello there"}]
配列は java で次のように宣言されます。
ArrayList<SomeType> arr = new ArrayList<SomeType>();
私はこのようにそのjspにajaxロードを行います:
$(document).ready(function (e) {
$('.container').load('GetArray.jsp', function (responseText, textStatus, XMLHttpRequest) {
$.each(responseText, function (index, response) {
$('.main').append(response.value);
$('.main').append('<br /><br /><br /><br />');
});
});
});
しかし、JSPが上で述べた配列を返すにもかかわらず、jQueryに何も出力させていません。
私はそれがjsonであることを知っていますが、どうすればそれを印刷できますか?