$.post()方法后台return不发生跳转

使用$.post()方法提交时候后台没有跳转到指定的页面,页面内容返回到resulut中了。

前台方法:

function reportToExcel(){
	var d=$("#search").serialize();
	console.log(d);
	$.post("report_createToExcel.action", d, function (result) 
			{ 
				console.log(result); 
			});
}

后台xml配置

<action name="report_createToExcel"
			class="com.ReportCreateToExcelAction">
			<result name="success" type="dispatcher">excel.jsp</result>
</action>

本来应该跳转到excel.jsp,但是没有发生跳转,在console.log(result)中result显示的内容是excel.jsp的内容。

上网查了一下发现,ajax是无法再controller里面return 跳转的,可以采用

var form = document.getElementById('search');
form.submit();

的方式去提交。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值