Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.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
表单中使用jquery的困难_Jquery_Html - Fatal编程技术网

表单中使用jquery的困难

表单中使用jquery的困难,jquery,html,Jquery,Html,我有一个表单,当我提交时,我的变量值为空。 知道会是什么吗 我的代码: $('#botaoSalvar').click(function () { $('form').trigger('submit'); }); $('form').submit(function () { if (defaults.tipoAcao == 2) {

我有一个表单,当我提交时,我的变量值为空。 知道会是什么吗

我的代码:

            $('#botaoSalvar').click(function () {
                $('form').trigger('submit');
            });

            $('form').submit(function () {
                if (defaults.tipoAcao == 2) {
                    var retorno = ($('form').serialize());
                } else {
                    var retorno = nomeidRegistro + '=' + idRegistro + '&' + ($(this).serialize());
                }
                debugger
                return retorno;
HTML:

Alterar Registro
描述基本数据:

您的代码中有一些错误:

</td><td><input type=" name=" descricaobasedados"="" value="1">
</td></tr><tr id="atributo3"><td><label for="NomeBaseDados">NomeBaseDados:</label>
</td><td><input type=" name=" nomebasedados"="" value="1">
类型
替换为您正在使用的任何
类型

我不知道这是否是你的全部问题,但我相信这肯定是有帮助的。使用
name
属性发布(提交)表单中的输入。如果未正确定义属性,则可能会收到
null


希望这能有所帮助。

哪些变量返回空值?看起来您正在覆盖jquery submit,但没有调用表单submit。我不确定那是什么,但这是我首先要看的地方。我也承认对“debugger”命令的作用很好奇。除此之外,我们真的希望看到表单的html(正如Siddharth指出的)@BenBarden
我应该回答这个问题,而不是把它作为一个注释:哦,好吧!哈哈,一切都好。事实上,我把我的作为一个评论,并决定复制粘贴它作为一个答案。
</td><td><input type=" name=" descricaobasedados"="" value="1">
</td></tr><tr id="atributo3"><td><label for="NomeBaseDados">NomeBaseDados:</label>
</td><td><input type=" name=" nomebasedados"="" value="1">
<input type="text" name="descricaobasedados" value="1">