前台js:
.
.
.
success : function(response, options){
dataStore.reload();
var result = response.responseText;
if(result == 0){
AppUtil.floatingInfo('添加成功!');
}else{
AppUtil.floatingInfo('添加成功!<br/>其中有 ' + result + ' 个企业已经添加过了!');
}
}
后台Action:
public void addCompanyCt(){
.
.
.
int count = this.getCompanyCtService().insertCompanyCt(companyId, ctCompanyIds);
super.renderText(count+"");
}
后台ServiceImpl:
public int insertCompanyCt(Long companyId, List ctCompanyIds) {
.
.
.
int count = 0;
count++;
return count;
}

本文介绍了一个简单的前后端交互示例,展示了如何通过前端JavaScript发送请求并解析后台返回的数据。前台部分实现了请求成功后的数据更新及提示信息显示;后台则完成了添加公司信息的操作,并返回受影响的记录数。
975

被折叠的 条评论
为什么被折叠?



