Easy jQuery/Ajax question on how to send values from a form
I am new to jQuery and Ajax but I understand some simple things. However my question is what I need to add to my existing code to submit the valu开发者_开发问答e of the selected value of the autocomplete script I use?
Thank you.
$("#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 form submission not working shows a good example to submit a form with ajax. You have only to change the value 'post' to 'get'
精彩评论