Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/439.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用document.getElementById发送表单_Javascript_Jquery - Fatal编程技术网

Javascript 使用document.getElementById发送表单

Javascript 使用document.getElementById发送表单,javascript,jquery,Javascript,Jquery,嗨,我使用基于ajax的表单。我的问题是,我不知道如何更改java脚本代码以使用提交函数。我想我必须集成在这个代码document.getElementById(“form1”).submit()中

嗨,我使用基于ajax的表单。我的问题是,我不知道如何更改java脚本代码以使用提交函数。我想我必须集成在这个代码
document.getElementById(“form1”).submit()中
   ;(function( $, window, document, undefined ) {

    $(document).ready(function() {

        if( $.fn.wizard ) {

            $( '.wzd-default' ).wizard({
                buttonContainerClass: 'mws-button-row'
            });

            if( $.fn.validate ) {
                $wzd_form = $( '.wzd-validate' ).validate({ onsubmit: false });

                $( '.wzd-validate' ).wizard({
                    buttonContainerClass: 'mws-button-row', 
                    onStepLeave: function(wizard, step) {
                        return $wzd_form.form();
                    }, 
                    onBeforeSubmit: function() {
                        return $wzd_form.form();
                    }
                });

                $wzd_v_form = $( '.wzd-vertical' ).validate({ onsubmit: false });

                $( '.wzd-vertical' ).wizard({
                    orientation: 'vertical', 
                    buttonContainerClass: 'mws-button-row', 
                    onStepLeave: function(wizard, step) {
                        return $wzd_v_form.form();
                    }, 
                    onBeforeSubmit: function() {
                        return $wzd_v_form.form();
                    }
                });

                $wzd_v1_form = $( '.wzd-ajax' ).validate({ onsubmit: false });

                $( '.wzd-ajax' ).wizard({
                    buttonContainerClass: 'mws-button-row', 
                    onStepLeave: function(wizard, step) {
                        return $wzd_v1_form.form();
                    }, 
                    onBeforeSubmit: function() {
                        return $wzd_v1_form.form();
                    }, 


                });
            }           
        }
    });

}) (jQuery, window, document);

您使用的是哪个库允许使用
.wizard
?此wizard()函数是什么?您有具体的代码示例吗?我猜你用的是这个库:?也许您需要在表单中添加一个类?然后单击“提交”按钮,我想一切都应该正常了……好了,我已经发布了上面的全部代码。@Antonis-是的,这是MWS向导表单。在原始代码中,它通过提交服务器响应向我显示。但我想提交一份报告。所以我可以用php说如果(isset($_POST['submit']))。。。。或者类似的东西。如果你想正确使用它,你应该找到它的文档。也许你应该在你的表格中加入一个类,我不知道它是如何工作的。您想在javascript中提交,还是从html中提交?我的意思是,表单确实有一个提交按钮,对吗?在javascript中,我想一个简单的.submit()就足够了。。。你能做一个JSFIDLE样本吗?