$.post()提交了数据,return不给跳转
生活随笔
收集整理的這篇文章主要介紹了
$.post()提交了数据,return不给跳转
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
本來Controller接到普通請求,return?“somePage”,這樣就跳轉(zhuǎn)了。
前臺用$.post()提交了數(shù)據(jù)(不需要回調(diào)),我了個大草,return那里就不給跳轉(zhuǎn)了
這樣怎么解決?
ajax是無法再controller里面return?跳轉(zhuǎn)的,可以返回后再??ajax的success里面進(jìn)行??window.location.href
Ajax是異步請求?只會接收最后返回的數(shù)據(jù),不會執(zhí)行頁面跳轉(zhuǎn)請求改變url地址,要跳轉(zhuǎn)的話,可以使用window.location.href
$.post()是簡寫的ajax函數(shù) $.ajax({type: 'POST',url: url,data: data,success: success,dataType: dataType }); 聲明是: jQuery.post( url [, data ] [, success ] [, dataType ] ) 可以在回調(diào)函數(shù)中處理,或者 .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
轉(zhuǎn)載于:https://www.cnblogs.com/zhujiabin/p/7124594.html
總結(jié)
以上是生活随笔為你收集整理的$.post()提交了数据,return不给跳转的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 简单的HTTP协议——《图解http》第
- 下一篇: C#代理多样性