duan35557593 2013-06-30 14:08
浏览 19

发布由ajax创建的表单数据(select)不可用[关闭]

I have 2 select element in form. first select element is static and second select option change according to first select element. for this i used jquery ajax. i am getting all things. The problems comes when i submit the form. i dont get the second select element value. My code is working in IE. But not in Chrome and Mozilla. My html file is

 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta charset="utf-8" />
 <title>DATA ENTRY</title>

 <script type="text/javascript" src="js/jquery-min.js"></script>


  </head>
 <body>

 <table class="data_table">
<form name="form2" id="form2" method="post" action="submit_ops.php" />
<tr>
    <td>
        <select name="databaseTable" class="databaseTable">
            <option value="">Select Table</option>
            <option value="value1">value1</option>
            <option value="value2">value2</option>
            <option value="value3">value3</option>
        </select>
    </td>
    <td>
        <select id="TableColumn">
        </select>
    </td>
</tr>
<tr>
    <td colspan="3"><input type="submit" value="Continue" name="usubmit"/></td>
</tr>

</form>
</table>
</body>
<script type="text/javascript">
$(document).ready(function(){
    $("[name^=databaseTable]").on("change", function(){
       var val=$(this).val();

        $.ajax({
            type: "POST",
            url: "ajax.php",
            data: {"val" : val},
            success: function(result){
                $("#TableColumn" ).html(result);

            }
        });

    });

});
</script>
 </html>

When i submit the form the value of TableColumn(second select element) is unavailable.

  • 写回答

1条回答 默认 最新

  • doukuanjing5404 2013-06-30 14:15
    关注

    change the data value for you $.ajax()

    $.ajax({
                type: "POST",
                url: "ajax.php?action=change_column",
                data: {"val" : val+"."+rowId},
                success: function(result){
                    $("#ColName_"+rowId ).html(result);
    
                }
            });
    

    Server Side

    get the passed value with $_POST['val']

    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图