ajax调用action成功后,无法进入success
$.ajax({
type:'post',
url:'privilegemgmt/resourceAction_updateDep.action',
cache:false ,
dataType:'json',
data:{
id:$('#myform').find('input[name=id]').val() ,
name:$('#myform').find('input[name=name]').val(),
count:$('#myform').find('input[name=count]').val(),
principal:$('#myform').find('input[name=principal]').val(),
description:$('#myform').find('textarea[name=description]').val()
} ,
success:function(data){
var node = $('#tree_org').treegrid('getSelected');
var parent = $('#tree_org').treegrid('getParent' , node.id);
$('#tree_org').treegrid('reload' , parent.id);
$.messager.show({
title:'提示信息',
msg:'操作成功!'
});
},
error:function(XMLResponse){
alert('12345');
}
});public String updateDep(){
try{
Department dep = new Department();
dep.setId(id);;
dep.setCount(count);
dep.setDescription(description);
dep.setName(name);
dep.setPrincipal(principal);
departmentManager.UpdateDepartment(dep);
String news = "{\"success\":true,\"id\":\"1\"}";
System.out.println(news);
return "success";
}catch(Exception e){
e.printStackTrace();
return null;
}
}
<package name="priviligemgmt" extends="struts-default" namespace="/privilegemgmt">
<action name="resourceAction_*" class="departmentAction" method="{1}">
<result name="input">/Department.jsp</result>
<result name="success">
<param name="root">news</param>
</result>
</action>
</package>
get,set方法都有,执行action方法正确,也按网上教的试了好多,也还是进入不了success..求大神指导
...全文
相关推荐
解决Extjs4中form表单提交后无法进入success函数问题
1.首先得确定json格式没问题 2.在返回的json中一定得加上success为true,因为只有为true,才会进入success函数 因为刚结束Extjs4,这个错误我调试了半天。
ajax调用action返回xml或list
在WEB开发中,一般,仅仅使用JSP+ajax+SEVLET或者jsp+struts2的其中某种方式进行,各自的缺点也非常明显。这里,给出了ajax直接调用ACTION并给前台进行list或者JSON的数据回传。很不错的哦!
jquery的ajax传json对象数组到struts2的action
google搜到的。我看大神的文章发布时间是2014年5月。亲测好用。 某度搜技术类的真真真心不行。
jquery.ajax 传参数到mvc的action
jquery.ajax 传参数到mvc的action
jQuery.Ajax 与action交互
NULL 博文链接:https://long316.iteye.com/blog/1322059


