在fancybox中提交表格 [英] Submiting a form in a fancybox
本文介绍了在fancybox中提交表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以创建要在花式框内提交的表单.
Is it possible to create a form to be submitted within a fancybox.
<a class="assignScoreValues" href="/quality/assign-score-values/id/1">Assign Score Values</a>
然后在控制器中显示要提交的表单.我无法重定向,因为我会丢失原始页面上的信息.
Then in the controller I display a form to be submitted. I can't redirect as I will lose the information on the original page.
我认为不可能吗?
推荐答案
您可以使用Jquery和serializeArray()
通过AJAX提交表单.要使用HTML链接进行提交,请执行以下操作:
You can submit the form with AJAX using Jquery and serializeArray()
. To use an HTML link for for submission:
<a onclick="var data=jQuery('#form_id').serializeArray();
$.ajax(
{
url:'url/to/post',
type:'POST',
data:data,
success:
function(data){
//do something on success, for example close fancybox:
$.fancybox.close();
}
});
return false;
"
href="javascript:void(0);">Save Form</a>
这篇关于在fancybox中提交表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文