簡體   English   中英

關於如何從表單發送值的簡單jQuery / Ajax問題

[英]Easy jQuery/Ajax question on how to send values from a form

我是jQuery和Ajax的新手,但我理解一些簡單的事情。 但是我的問題是我需要添加到現有代碼中以提交我使用的自動完成腳本的選定值的值?

謝謝。

$("#s").autocomplete("rpc.php", {
    width: 250,
    selectFirst: false,
    minChars: 3,
    scroll:true,
    matchContains: true,
    scrollHeight: 250
}).result(function(event, item) {
     $.ajax({
        // what to send here?

            })
});

<form method="get" action=".php">
<input type="text" name="s" id="s" class="inputsearch">
<input id="searchform" type="submit">
</form>
.result(function(event, item) {
 $.ajax(
     {
         data: item,
         url: "insert url here",
     })
 });

jQuery AJAX表單提交不起作用顯示了使用ajax提交表單的一個很好的示例。 您只需將值'post'更改為'get'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM