【问题标题】:Ajax stops filling select multiple when name is added to select将名称添加到选择时,Ajax 停止填充选择多个
【发布时间】:2013-02-28 15:44:05
【问题描述】:

我试图让用户单击“多选”表单中列出的项目,然后单击“开始”。 Select Multiple 当前正在由 Ajax 更新程序填充。在我将 name="subjects" 添加到 Select Multiple 之前,Ajax/Form 效果很好,然后 Ajax 不再填充 Select。这可能是一个简单的修复。

我的代码:

<form id="searchform" method="get" action="findsyllabi.php">
    <input type="textbox" onkeyup="sendRequest()" name="search_query" />
    <input type="submit" id="search_select_submit" value="Go">
    <input type="hidden" name="searchtype" value="subjects">
    <select multiple id="show_results" name="subjects" />
    </select>
</form>

<script type="text/javascript" src="http://poseidonwebstudios.com/test/ccl_cms/js/prototype.js"></script>
<script>
    function sendRequest() {
        new Ajax.Updater('show_results', 'search.php', { method: 'post', parameters: $('searchform').serialize() });
    }
</script>

【问题讨论】:

  • $('searchform').serialize() 应该是$('#searchform').serialize()
  • 这会破坏更新程序。

标签: php html mysql ajax prototype


【解决方案1】:

你应该使用form id。试试这个,

$('#searchform').serialize();

【讨论】:

    猜你喜欢
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-21
    • 1970-01-01
    相关资源
    最近更新 更多