简体   繁体   English

如何使用Twitter Bootstrap向导将表单数据提交到php

[英]How to submit form data to php using Twitter Bootstrap Wizard

I'm using http://vadimg.com/twitter-bootstrap-wizard-example/#docs and I am having difficulty finding how to submit the data to the backend php script. 我正在使用http://vadimg.com/twitter-bootstrap-wizard-example/#docs ,但是我很难找到如何将数据提交到后端php脚本。

Once I have initialised the Wizard I have tried to add into the options being passed to the method a submitURL (I read somewhere it could be set as var wizard = $("#some-wizard").wizard({submitUrl: "/some_url"}); 初始化向导后,我尝试将传递URL的选项添加到一个SubmitURL(我在某处读取,可以将其设置为var wizard = $("#some-wizard").wizard({submitUrl: "/some_url"});

I have also tried the following : 我也尝试了以下方法:

var wizard =  FormWizard.init();

$('#form_wizard_1 .button-submit').click(function (wizard) {
        $.ajax({
            url: "local_tmf_setup.php",
            type: "POST",
            data: wizard.serialize(),
            success:function(){
                alert('success.');
            }
        });               
     }).hide();

But it fails on the serialize method. 但是它在序列化方法上失败。

I've also looked at the documentation here: https://github.com/VinceG/twitter-bootstrap-wizard to see if there is an onSubmit event that the options could be passed to, but it appears the only event is onLast which I have tried as well. 我也在这里查看了文档: https : //github.com/VinceG/twitter-bootstrap-wizard ,看看是否存在可以将选项传递给onSubmit事件,但看来唯一的事件是onLast我也尝试过。

Any ideas? 有任何想法吗?

My wizard contains information stored in a knockoutJS view model, so I just write it to the backend using a normal ajax / JSON call. 我的向导包含存储在淘汰表视图模型中的信息,因此我只是使用常规的ajax / JSON调用将其写入后端。 Would that be an idea? 那是个主意吗? I was not aware that the wizard even had a submit parameter. 我不知道该向导甚至有一个Submit参数。

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

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