我如何为每个新对象创建一个不同的URL

问题描述 投票:0回答:1

我已经建立了该站点“ https://supsurvey.herokuapp.com/SurveyCreate.html”您创建调查,然后将其重定向到唯一的URLhttps://supsurvey.herokuapp.com/SurveyPage.html#718807c9-3a5b-4745-b953-511afef5e073我本来是想靠纯粹的运气做到这一点的。

在surveyCreate页面中,我具有location.assign(SurveyPage.html#${survey.id})//,因此将其移至SurveyPage.html,该链接链接到SurveyPage.js,然后从其中使用currentUrl.split(#)提取uuid4,然后发送对我的服务器的获取请求,该服务器内置NODE-JS(仅适用于mongoDB中的强调查对象)以获取正确的调查对象,并将其显示给用户。

我希望如此,以便您按创建调查后将被重定向到

https://supsurvey.herokuapp.com/SurveyPage/718807c9-3a5b-4745-b953-511afef5e073

所以不是.html#{uuid}到/ {uuid}

我该怎么做?

我已尝试更改为location.assign(SurveyPage/${survey.id})但失败,因为没有.html扩展名找不到文件

我也尝试过location.assign(SurveyPage.html/${survey.id}),它也不起作用

location.assign(`SurveyPage.html#${survey.id}`)

我建立了这个站点“ https://supsurvey.herokuapp.com/SurveyCreate.html”,您创建了一个调查,然后将其重定向到唯一的URL https://supsurvey.herokuapp.com/SurveyPage.html#718807c9 -3a5b -...

javascript url server backend id
1个回答
0
投票

因为您将NODE用于后端-您可以使用express构建应用程序

© www.soinside.com 2019 - 2024. All rights reserved.