表单serializeArray不起作用

时间:2013-07-30 21:21:46

标签: jquery html html-form

<form name = "indexSummaryForm">
<table class = "rtmindex">                                                  
    <tr>
        <td class = "rtmcolumntwo">
            <select id = "intraDayFXRateType" name = "intraDayFXRateType" class = "rtmindexselect">
                <option id = "4" selected>SPOT</option>
            </select>
        </td>
        <td class = "rtmcolumnfour">
            <input id = "preMarketOpenInterval" name = "preMarketOpenInterval" class = "rtmindexcell" type = "text" value = "0" />
        </td>
        <td class = "rtmcolumnsix">
            <select id = "intraDayFXRateBehaviour" name = "intraDayFXRateBehaviour" class = "rtmindexselect">
                <option id = "1" selected>Spot Rate</option>
                <option id = "2">Prev. Day WMSpot</option>
            </select>
        </td>
    </tr>

</table>
</form>

当我尝试提交表单时,提醒(“test:”+ $('#indexSummaryForm')。serializeArray());返回null。请检查并告知代码中有什么问题?

2 个答案:

答案 0 :(得分:1)

您没有 id indexSummaryForm

的表单
 $('[name=indexSummaryForm]') // Should work

否则,您可以将ID添加到表单并使用id selector

答案 1 :(得分:1)

此代码

$('#indexSummaryForm').serializeArray())

要求的对象具有 ID =“indexSummaryForm”,您没有ID属性。