日期:2014-05-17 浏览次数:20792 次
function xiao(){
$.ajax({
url: "<%=basePath %>/ajax/getStars.do",
contentType: "application/json;charset=utf-8",
type: "get",
dataType: "json",
success: function(data) {
alert(data);
},
error: function() {
alert("系统发生异常,请稍候再试!\n\n有任何疑问,请联系系统管理员!");
}
});
}
@Controller
public class Ajax {
@Autowired
private StarService starService;
private static final Logger logger = LoggerFactory.getLogger( Ajax.class );
@RequestMapping( value = "/ajax/getStars", method = RequestMethod.GET )
@ResponseBody
public String getAllStar( HttpServletResponse response ) {
logger.info( "异步查询明星" );
List<Star> stars = starService.getAllStar();
return null;
}
}
import net.sf.json.JSONObject;
dataType: "json",
@Controller
public class Ajax {
@Autowired
private StarService starService;