简体   繁体   English

返回HTTP响应重定向与目标URL,Python

[英]return http response redirect with destination url, python

Noob Here, I am having issues with my registration form in ajax and javascript. Noob在这里,我的Ajax和javascript注册表格出现问题。 So I am seeing how to do a return httpresponse with a destination URL in a python script. 因此,我正在查看如何在python脚本中使用目标URL进行返回httpresponse的操作。 I am not using django or flask. 我没有使用django或flask。 Does anyone know of a page that I can read to understand this topic. 有谁知道我可以阅读以理解该主题的页面。

Questions 1. Does this have any import dependencies? 问题1.这是否有任何导入依赖关系? 2. Is this code correct down below? 2.下面的代码是否正确? and if not what can be done to fix it. 如果没有,该如何解决。 I want to send it to a thank you page. 我想将其发送到“谢谢”页面。

return HttpResponseRedirect("url")

No. The code you have is a Django snippet and will not work unless you are using Django. 不。您拥有的代码是Django代码段,除非您使用的是Django,否则该代码将无法正常工作。

If you are not using any framework, then return a 303 See Other status code, along with a Location header with the URL to your thank you page. 如果您不使用任何框架,则返回303请参阅其他状态代码,以及带有您的感谢页面URL的Location标头。

The HyperText Transfer Protocol (HTTP) 303 See Other redirect status response code indicates that the redirects don't link to the newly uploaded resources but to another page, like a confirmation page or an upload progress page. 超文本传输​​协议(HTTP)303请参阅其他重定向状态响应代码,指示重定向不链接到新上传的资源,而是链接到另一个页面,如确认页面或上传进度页面。 This response code is usually sent back as a result of PUT or POST. 此响应代码通常作为PUT或POST的结果发送回去。 The method used to display this redirected page is always GET. 用于显示此重定向页面的方法始终是GET。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM