更新时间:2023-11-11 09:24:10
您不能从异步调用中返回View
.
Ajax请求的目的是避免执行整个页面周期.
You can not return a View
from an asynchronous call.
An ajax request is meant to avoid doing an entire page cycle.
如果您要返回新的View
,则只需返回POST
.
You should just do a POST
back if you want a new View
to be returned.
另一个选择是在ajax调用成功后进行回调,并将window.location
设置为新的View
,以便页面将GET
设置为新的View
.
The other option would to be have a callback upon success of the ajax call and set the window.location
to the new View
so the page does a GET
to the new View
.