$.ajax( {
type : "POST",
url : "url",
data: "",
success : function(msg) {
//此处msg并不是json对象,需要转换
json = JSON.parse(msg);
}
然后是后台:
这边如果是个list或数组
可以用
JSONArray jsonmap = JSONArray .fromObject(list);
如果是map<String,Object>如map<String,List>
就用
JSONObject jsonmap = JSONObject.fromObject(tMap); //System.out.println(jsonmap); //List<String> strList = new ArrayList<String>(); pWriter.print(jsonmap); pWriter.flush(); pWriter.close();
原文链接:https://www.f2er.com/ajax/165924.html