简体   繁体   English

点击提交按钮后如何关闭灯箱表单?

[英]How to close light box form after clicking on submit button?

I have a light box form (and have a page in the background).我有一个灯箱表单(并且在后台有一个页面)。 I want to close the light box and stay on that page after clicking on the submit button.单击提交按钮后,我想关闭灯箱并留在该页面上。 But it's redirecting to another page (PHP database connection page) after clicking the submit button.但点击提交按钮后,它会重定向到另一个页面(PHP 数据库连接页面)。

I want to know how to close light box and stay on that page.我想知道如何关闭灯箱并留在该页面上。

Add an event listener to the form that handles the form request and then return false from that handler and the page won't refresh.将事件侦听器添加到处理表单请求的表单,然后从该处理程序返回 false 并且页面不会刷新。 Because we don't know which lightbox you are using we can't exactly tell you how to remove it... but if you're using jQuery you could use something like:因为我们不知道您使用的是哪个灯箱,所以我们无法准确地告诉您如何删除它……但如果您使用的是 jQuery,您可以使用类似的东西:

$("#lightbox-id").hide();

or或者

$("#lightbox-id").remove();

If you haven't found your answer i believe this is it... check in your extension from chrome;如果您还没有找到答案,我相信就是这样...从 chrome 中检查您的扩展程序;

  1. go to settings in your chrome browser go 到 chrome 浏览器中的设置

  2. then extensions [chrome://extensions/].然后扩展 [chrome://extensions/]。

It should have the words "form" "promo"它应该有“形式”“促销”字样

here is the link after uninstalling这是卸载后的链接

https://www.geteasyforms.com/exit-survey?ti=7BCNr3xaTXfKQfvyuDBX https://www.geteasyforms.com/exit-survey?ti=7BCNr3xaTXfKQfvyuDBX

Use JavaScript to submit the form within the lightbox & close the lightbox.使用 JavaScript 在灯箱内提交表单并关闭灯箱。

function send_form ( )
{
ajax = new XMLHttpRequest;
if (!ajax) return false;

ajax.open('POST', '/index/send_form/'); //your post url should be here
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

var field0= document.getElementById('submit').value;
var field1 = document.getElementById('message').value; //you should modify these fields according to your form 

ajax.send('sub=' + submit + '&message=' + content);
//then post url becomes something like: www.example.com/index/send_form/?sub=submit&message=this

//then close the lightbox in here
}

and for the html part remove action attribute and call this function in onsubmit event.对于 html 部分,删除操作属性并在 onsubmit 事件中调用此 function。

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

相关问题 单击提交按钮后如何在文本框下方发布评论? - how to post comment below the text box after clicking submit button? 如何通过单击“提交”按钮提交表单 - How to submit a form by clicking submit button only 如何在用户输入数据后 2 秒自动提交(不单击提交按钮)表单 - How to auto-submit(without clicking submit button) the form , 2 seconds after the user has typed in the data 如何在不单击提交按钮的情况下提交页面加载表单? - How to submit a form on page load without clicking submit button? 单击引导警报的关闭按钮后,表单不起作用 - Form does not work after clicking close button of bootstrap alert 单击表单中的提交按钮后,无法访问Imagecord功能 - Imagecord function is not getting accessed after clicking the submit button in form 单击提交按钮以处理表单后弹出图像 - Image popop after clicking submit button for processing form 单击提交按钮后,将表单提交的文本值分配给变量 - allocate text value submitted by a form to a variable after clicking submit button 表单有效时,单击“提交”按钮后显示加载图像 - Show a loading image after clicking the submit button when the form is valid 单击表单中的提交按钮后,一切都变得不确定 - After clicking the submit button in a form, everything became undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM