Grails: Page won't redirect after completed Ajax call

后端 未结 2 1634
耶瑟儿~
耶瑟儿~ 2021-01-22 11:01

This is my ajax call:

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-22 12:07

    Browsers won't redirect if an AJAX call returns a redirect. If you want to send the user to a new page after an AJAX call, you'll need to do so yourself in Javascript. Example:

    def url = createLink(controller: 'user', action: 'authenticate')
    render(contentType: 'text/html', text: "")
    

    Ensure the AJAX response gets rendered by the browser. With the grails remoteFunction tag you should specify an element to update with the update attribute.

提交回复
热议问题