简体   繁体   English

Colorbox AJAX中的表单:提交表单后,我需要关闭Colorbox并将访问者重定向到结果页面

[英]Form in Colorbox AJAX: after form submitted, I need Colorbox to close and the visitor redirected to results page

I have a search form I'm going to have it in Colorbox. 我有一个搜索表单,将在Colorbox中使用它。 The user will click on a link "Search" on any given page on the site, colorbox will open and frame a page with a search form in colorbox. 用户将在站点上任何给定页面上单击“搜索”链接,colorbox将打开并在colorbox中使用搜索表单框住页面。 After the user submits the form, the problem is the form redirects to a new page but it is still in colorbox. 用户提交表单后,问题在于表单重定向到新页面,但仍在颜色框中。 This is a problem b/c the search results page doesn't fit into Colorbox. b / c搜索结果页面不适合Colorbox,这是一个问题。 Instead, I'd prefer to have it so that when the user submits the form, colorbox closes and the user is redirected to the results page for the search results. 取而代之的是,我希望使用它,以便在用户提交表单时,颜色框关闭,并将用户重定向到搜索结果的结果页面。

Thanks! 谢谢!

You could possible do: 您可以这样做:

var form = $("colorbox > iframe").contents().find("form").clone();
form.appendTo("body").submit();

Turns out Colorbox closes upon submitting the form. 事实证明,Colorbox在提交表单后关闭。 I should have tested before asking questions. 我应该在问问题之前进行测试。 Sorry :( 对不起:(

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

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