[node] res.redirect

楼主: bnn1999 (bnn1999)   2020-02-05 02:25:16
大家好,最近在学express,
不太知道为什么res.redirect不能用,
但cookie是成功的,
程式码如下
https://i.imgur.com/1R5y8Tw.jpg
谢谢大家
作者: pkro12345 (席龙)   2020-02-05 12:05:00
改成./test.html试试? 不然可能会被当成URL
楼主: bnn1999 (bnn1999)   2020-02-05 17:39:00
改了也不行,那请问还有什么方法可以实现跳页的吗
作者: pkro12345 (席龙)   2020-02-05 17:52:00
你有把test.html设成静态档吗?加个这个试试 app.use(express.static('./'));
楼主: bnn1999 (bnn1999)   2020-02-05 18:01:00
有欸,改成./test.html后,ajax会失败,但cookie那些都有设定到,就redirect会失败,谢谢
作者: pkro12345 (席龙)   2020-02-05 18:09:00
你的test.html放在哪里?ajax的失败是怎样的失败?没拿到资料还是?
楼主: bnn1999 (bnn1999)   2020-02-05 18:34:00
p大 我站内信了
作者: cf1064 (蚵仔)   2020-02-06 09:34:00
在呼叫AJAX那页处理跳页
楼主: bnn1999 (bnn1999)   2020-02-08 00:28:00
cf谢谢

Links booklink

Contact Us: admin [ a t ] ucptt.com