在js中请求ajax,把jsp中的一个Cno传到Servlet中
$.ajax({
type :"post",
url : "ShowDetail?Cno="+Cno,
async:false,
dataType : "json",
success : function(data) {
},
error : function() {
var student =eval("(" +result +")");
alert(student.Cth1);
}
});
在Servlet中获取后台值,并out.print JSON格式
out.print("[{'Cno':'"+Cno+"','Cth1':'"+cd.get(0).getCth1()+"']});
应该如何通过ajax获取这里面的值
我通过 var student =eval("(" +result +")"); 的方法,但是student.Cth1获取不了值
这里用Error是因为Success没有反应。