jsp:
<script type="text/javascript">
jQuery.getJSON("/tools/test_ajax.jsp?jsoncallback=?",
{
tags:"cat",
tagmode:"any",
format:"json"
},
function(data){
// for(var i=0;i<data.length;i++){
// alert(data[i].name) ;
// }
jQuery.each(data,function(i,item){
alert(item.name) ;
}) ;
}
) ;
</script>
----------------------------------------------------------------------------
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
String tag = request.getParameter("tags") ;
String callback = request.getParameter("jsoncallback") ;
System.out.println("99"+tag) ;
out.println(callback+"([{\"name\":\"test\"},{\"name\":\"test02\"}])") ; %>