fancybox form submit

旧巷老猫 提交于 2019-12-23 01:59:36

问题


I have a form that submits some content to a database and it works fine.

Now I want to move it to a fancybox. The problem is that when I click the submit button on the fancybox the page redirects to the actual form page instead of staying on the fancybox.

Any idea on how to stop the page from redirecting?

Thanks


回答1:


How are you loading the content into the fancybox? If you use the iframe method, it should remain within it.

See point 4 on this page to load data as an iframe http://fancybox.net/howto

EDIT

You need to put the form in a separate page and then load that page into the fancybox using the method specified. For example, if you created a new page called myform.asp which would contain your form and form. You would then create a link on your page to contain your fancybox which would call the myform.asp page in an iframe:

<a href="http://www.yourdomain.com/myform.asp" class="iframe">Fill Out Form</a>



回答2:


You could do an ajax post request.

See: http://jquery.malsup.com/form/



来源:https://stackoverflow.com/questions/4648312/fancybox-form-submit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!