[問題] 從 jsp 傳 json 到 javascript
已經照T大改了
可是還是不能@@
已經用 chrome 的 debugger 去看
顯示以下錯誤訊息
http://gyazo.com/f979d13ad312072e32b1580a967fc343
我的 javascript
function handler() {
if(AJAX.readyState == 4 && AJAX.status == 200) {
var json = eval('(' + AJAX.responseText +')');
alert( json.name[0] + '<BR>' + json.name[1] );
}else if (AJAX.readyState == 4 && AJAX.status != 200) {
alert('Something went wrong...');
}
}
jsp
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="org.json.simple.JSONObject"%>
<%
String []apple = new String[3] ;
for ( int i = 0 ; i < 3 ; i++ )
apple[i] = "aa" ;
JSONObject obj = new JSONObject();
obj.put( "name", apple );
out.print( obj );
out.flush();
%>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.204.244.108
→
10/01 22:59, , 1F
10/01 22:59, 1F
→
10/02 13:02, , 2F
10/02 13:02, 2F
→
10/02 15:34, , 3F
10/02 15:34, 3F
→
10/02 15:35, , 4F
10/02 15:35, 4F
→
10/02 15:35, , 5F
10/02 15:35, 5F
※ 編輯: wind75609592 來自: 123.204.244.108 (10/02 17:52)
→
10/02 21:09, , 6F
10/02 21:09, 6F
→
10/02 21:10, , 7F
10/02 21:10, 7F
→
10/02 21:10, , 8F
10/02 21:10, 8F
※ 編輯: wind75609592 來自: 123.204.244.108 (10/02 22:19)
※ 編輯: wind75609592 來自: 123.204.244.108 (10/02 22:39)
推
10/02 23:18, , 9F
10/02 23:18, 9F
→
10/02 23:18, , 10F
10/02 23:18, 10F