简体   繁体   English

从第三方网站填写表格后如何将用户重定向到 URL

[英]How to redirect user to a URL after filling out a form from a third party site

I am learning Clickfunnels right now and I encountered a problem.我现在正在学习 Clickfunnels,但遇到了问题。 I want to redirect to another url after submitting a form.提交表单后,我想重定向到另一个 url。 This form is from a third-party site so I just copy the form code from the site and paste it to my code editor on Clickfunnels.此表单来自第三方站点,因此我只需从站点复制表单代码并将其粘贴到 Clickfunnels 上的代码编辑器。

The following is the code of the form that I copied from the site.以下是我从网站复制的表单代码。

 <div id="MYID" data-so-page="MYIDPAGE" data-height="550" data-style="border: 1px solid #d8d8d8; min-width: 290px; max-width: 900px;" data-psz="00"></div> <script type="text/javascript" src="https://cdn.oncehub.com/mergedjs/so.js"> </script>

Now, what I want to do after submitting the form is to redirect to another url, say "google.com".现在,提交表单后我想做的是重定向到另一个 url,比如“google.com”。 Do you have any idea how to do it?你知道怎么做吗?

Add onclick tag to form添加onclick标签形成

<form id="myform" method="post" onclick="window.open('http://yoururl.com', '_blank');">  
  <input type="submit" class="button4" value="Place Order" >
</form>

or use the function或使用 function

window.onload=function() {
  document.getElementById("myform").onsubmit=function() {
    window.location("redirectpage.php");
    return false;
  }
}

form形式

<form id="myform" method="post">  
  <input type="submit" class="button4" value="Place Order" >
</form>

I assume your form is generated by the script that you require from the 3rd party library.我假设您的表单是由您从 3rd 方库中需要的脚本生成的。 Therefore you cannot add anything directly to the form, but you can select it with a dom query amd add a onsubmit event handler.因此,您不能直接向表单添加任何内容,但您可以使用 dom 查询 select 并添加 onsubmit 事件处理程序。

Something like this maybe: var form = document.querySelector("#MYID > form");可能是这样的: var form = document.querySelector("#MYID > form"); form.addEventListener("submit", e => //redirect here); form.addEventListener("submit", e => //重定向这里);

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

相关问题 填写联系表后,如何将用户返回到他们来自的页面? - How do I return a user back to the page they came from after filling out a contact form? 填写所有表单字段后如何从 javaScript 重定向到页面 - how to redirect to a page from javaScript after filling all the form fields 如何在站点上配置SSL时向第三方提交表单 - How To submit a form to third party when SSL is configured on the site 仅当用户来自该页面时,如何在提交表单后将 CodeIgniter 中的 URL 重定向回上一页? - How to redirect URL in CodeIgniter after form submission back to the previous page only when the user comes from that page? 如何从Sizmek实施第三方印象跟踪URL? - How to implement third-party impressions tracking URL from Sizmek? 如何在我的网站上删除第三方网站图标? - How to remove third party favicon on my site? React - 提交表单时重定向到第三方网站 - React - Redirect to third party website when submit form 重定向到 html 上的第三方网站提交并重置 html 表单 - Redirect to third party webiste on html submit and reset html form 如何重定向来自特定站点的用户 - How to redirect user coming from certain site 如果javascript在第三方站点上,如何从javascript进行rest api的身份验证? - how to do authentication of rest api from javascript, if javascript is on third party site?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM