前台:
$.ajax({
url : 'queryRegion',dataType: 'JSON',async : false,success: function(data){
var rg = $(document).find("#regionName");
for(var i=0;i<data.length;i++){ rg.append("<option value='"+data[i]["REGION_NAME"]+"'>"+ data[i]["REGION_NAME"]+ "</option>");
}
}
});
@RequestMapping(value = "/queryRegion",method = RequestMethod.GET)
public void queryRegion(HttpServletRequest hrequest,HttpServletResponse response){
List<Map<String,Object>> dataRegions = ggfwCooperationService.listQueryRegion();
PrintWriter out;
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-type","textml;charset=UTF-8");
out = response.getWriter();
String json = JSONUtil.writeListMapJSONMap(dataRegions);
out.write(json);
} catch (IOException e) {
e.printStackTrace();
}
}