[英]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 中检查您的扩展程序;
go to settings in your chrome browser go 到 chrome 浏览器中的设置
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.