简体   繁体   English

提交表单后显示新的colorbox div

[英]Display new colorbox div after form submitted

I have a form that is displayed inline using colorbox. 我有一个使用colorbox在线显示的表单。 After the form is submitted, and on success, I want to display a new form saying "thanks for submitting". 提交表单后,成功完成后,我想显示一个新表单,上面写着“感谢提交”。 I know I could just change the HTML, but I need to keep the original form (div) so that if someone wants to ask another question they just don't see the HTML that replaced the original form. 我知道我可以更改HTML,但是我需要保留原始表单(div),这样,如果有人要问另一个问题,他们只是看不到替换原始表单的HTML。 I have two div's. 我有两个div。 First is just a hidden div with form and the second is div id="cbrequestformconfirm". 第一个是具有形式的隐藏div,第二个是div id =“ cbrequestformconfirm”。 Right now, after the form button (id=submitrequest) is clicked it does change the colorbox, but it is empty. 现在,在单击表单按钮(id = submitrequest)后,它确实会更改颜色框,但是它是空的。 Thanks for any help and here is the code. 感谢您的帮助,这里是代码。 Let me know if you need additional info. 让我知道您是否需要其他信息。

$('#submitrequest2013').click(function(){

    $.post('/form.asp?t='+d.getTime(), $('#communityform').serialize(), function(data) {
       //success
       $("#cbrequestformconfirm").colorbox({inline:true, open:true, width: "50%", Height: "50%"});
    });

    return false;
});

try this: 尝试这个:

EDIT: correction to call: 编辑:更正:

$.colorbox({href:"#cbrequestformconfirm",inline:true, open:true, width: "50%", Height: "50%"});

where you have this html: 你有这个HTML:

<div display="none">
    <div id="cbrequestformconfirm">
        Success!
    </div>
</div>

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

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