$.ajax({
url : "user!findUserList.action",
type : "post",
success: function(data){
var jsonObj=eval("("+data+")");
$.each(jsonObj, function (i, item) {
jQuery("#userList").append("<option value="+ item.userId+">"+ item.userRealName+"</option>");
});
},
error: function(text) {}
});
代码如下:
public void findUserList() throws IOException {
List<UserModel> roleuserList = userService.findUserList();
String json = JSONArray.fromObject(roleuserList).toString();
writeHtml(json);;
}
代码如下:
protected void writeHtml(String strData) {
try {
response.setContentType("text/html; charset=UTF-8");
PrintWriter pw = response.getWriter();
pw.write(strData);
pw.flush();
pw.close();
} catch (IOException e) {
log.error("writeHtml()", e);
}
}
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com