本来Controller接到普通请求,return “somePage”,这样就跳转了。
前台用$.post()提交了数据(不需要回调),我了个大草,return那里就不给跳转了
这样怎么解决?

ajax是无法再controller里面return 跳转的,可以返回后再  ajax的success里面进行  window.location.href

Ajax是异步请求 只会接收最后返回的数据,不会执行页面跳转请求改变url地址,要跳转的话,可以使用window.location.href

$.post()是简写的ajax函数
$.ajax({
  type: 'POST',
  url: url,
  data: data,
  success: success,
  dataType: dataType
});
声明是:
jQuery.post( url [, data ] [, success ] [, dataType ] )
可以在回调函数中处理,或者 .done中处理:
var jqxhr = $.post( "example.php", function() {
  alert( "success" );
})
  .done(function() {
    alert( "second success" );
  })
  .fail(function() {
    alert( "error" );
  })
  .always(function() {
    alert( "finished" );
});

  

Null ModelAndView returned to DispatcherServlet with name 'webmvc': assuming HandlerAdapter completed request handling

相关文章:

  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
  • 2021-06-06
猜你喜欢
  • 2021-06-21
  • 2021-08-01
  • 2021-11-27
  • 2021-12-26
  • 2021-06-12
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案