search

Home  >  Q&A  >  body text

java - 前端页面请求后端不返回页面

怪我咯怪我咯2827 days ago877

reply all(7)I'll reply

  • 怪我咯

    怪我咯2017-04-18 10:39:18

    This is an ajax request. The ajax request page will not jump.
    Why don’t you just use a normal request if you log out?

    reply
    0
  • 黄舟

    黄舟2017-04-18 10:39:18

    You just sent an ajax request on the front end instead of a page jump.

    Either let the backend return json data, and the frontend uses js to jump to the landing page according to its content;
    or the frontend jumps directly to the target address, and let the backend redirect to the landing page.

    reply
    0
  • 黄舟

    黄舟2017-04-18 10:39:18

    Control page jump after ajax returns results:

    location.href = 'xxxxx'

    reply
    0
  • 黄舟

    黄舟2017-04-18 10:39:18

    The return data of the ajax request will be processed in the return function function(data, status). You can jump to the page in this function
    You can also write like this

    $('#exit').click(function(){
       window.location.href = location.host + "../Exit"; 
    });

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:39:18

    Using ajax to call itself is wrong, so the front-end page will not jump. If you don’t believe me, type out the data and status in the ajax callback function to see what the result is

    Jumping can be done on both the front and back ends. If you use ajax, it means you want to receive things from the back end and not let it control the page jump. If you want to control the back end, just use location.href

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:39:18

    Ajax requests will not jump in the background code because asynchronous work has been performed. After executing your background code, the content in your
    Exit(){...} method will be returned to your front-end Ajax The function(data,status) method exists in data.
    If you want to jump: use it in the method body

    if(data=="Login"){
        window.location.href="url";
    }

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:39:18

    Did you not configure the view resolver

    reply
    0
  • Cancelreply