简体   繁体   English

jQuery-Colorbox插件,我需要通过Ajax提交表单

[英]jquery - colorbox plugin, I need to submit form via ajax

If I'm using the colorbox plugin , how do I submit a form via ajax and then make a new modal out of the response? 如果我使用的是colorbox插件 ,如何通过ajax提交表单,然后根据响应做出新的模式? For example, the user clicks a link and a modal pops up. 例如,用户单击一个链接,然后弹出一个模式。 They fill out the form and click submit and then the modal should change to the next form. 他们填写表格并单击提交,然后模式应更改为下一张表格。 Then they fill out the next one etc... 然后他们填写下一个,等等。

You should be able to load the <div id="cboxLoadedContent"> from the first colorbox invocation with the result of your ajax call: 您应该能够从第一个colorbox调用中加载<div id="cboxLoadedContent">并使用ajax调用的结果:

$('#cboxLoadedContent').load('form-process.php', formData);

If the new form you're loading is a different size you should also call the colorbox resize() method to adjust the size of the modal: 如果您要加载的新表单的大小不同,则还应该调用colorbox resize()方法来调整模式的大小:

$.colorbox.resize();

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

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