jquery - colorbox插件,我需要通过ajax提交表单

时间:2022-11-23 20:26:53

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? 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...

如果我正在使用colorbox插件,如何通过ajax提交表单然后从响应中创建一个新模式?例如,用户单击链接并弹出模式。他们填写表单并单击“提交”,然后模式应更改为下一个表单。然后他们填写下一个等...

1 个解决方案

#1


0  

You should be able to load the <div id="cboxLoadedContent"> from the first colorbox invocation with the result of your ajax call:

您应该能够从第一个颜色框调用中加载

以及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();

#1


0  

You should be able to load the <div id="cboxLoadedContent"> from the first colorbox invocation with the result of your ajax call:

您应该能够从第一个颜色框调用中加载

以及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();