我有一个表格,当我提交我的变量值时,我的变量将变为空。知道可能是什么吗?
我的代码:
$('#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:
<div id="alterarDados" aria-labelledby="ui-id-4" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" style="display: block;" aria-expanded="true" aria-hidden="false"><h3>Alterar Registro</h3>
<form id="formAlterar" action="/teste/index3" method="post">
<div id="corpoTabelaAlterar"><tr id="atributo2">
<td><label for="DescricaoBaseDados">DescricaoBaseDados:</label>
</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">
</td></tr><tr><td><input id="botaoVoltar" type="button" value="Voltar" name="voltar">
</td><td><input id="botaoSalvar" type="submit" value="Salvar" name="salvar">
</td></tr></div><table cellpadding="4" cellspacing="1" width="450" id="tabelaAlterar">
</table>
</form>
</div>