我有一个String数组响应,我需要在Ajax调用中传递;任何人都可以帮忙吗? 我的控制器是:
@RequestMapping(value = "/getBuildrpms", method = RequestMethod.GET)
public @ResponseBody String[] getBuildrpms(
@RequestParam("buildid") String buildid,
ModelMap model,
HttpServletRequest request) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String response = Util.executeCommand(Constants.HOST_NAME_FUSION,
auth.getName(), auth.getCredentials() + "",
Constants. SCRIPT_LIST_RPMS + buildid);
String animals = response;
String[] animalsArray = animals.split(",");
return animalsArray;
}
我的Ajax电话:
function pushtotr() {
jq(function () {
jq("#pushtotr").html('<p><img src="../../images/load.gif"/></p>');
jq.get("getBuildrpms", {
buildid: jq("#buildid").val()
},
function (data) {
//How can I retrive the array value here.
jq("#pushtotr").html(data);
});
});
}
我想在JSP页面中显示。