Hey all,
First post to these forums as I usually can figure out issues on my own but I am stumped on this.
I am attempting to implement a member search feature where the user can begin typing and a member list is displayed, when they find the right person, they click or select them and it submits their data to another ajax function I have. For now I would accept seeing the "aha" alert appear but nothing is happening at all now. If I use the most basic of autocomplete examples provided it works, but I need to pass the id at selection to filter for the member.
header
- <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<script>
$( "#membersearch" ).autocomplete({
minLength: 2,
source: function( request, response )
{
$.ajax(
{
url: "../_functions/members.asp",
data: {
term: request.term
},
type: "POST", // a jQuery ajax POST transmits in querystring format in utf-8
dataType: "json", //return data in json format
success: function( data )
{
response( $.map( data, function( item )
{
return{
label: item.fullname,
value: item.id
}
}));
}
});
},
});
select: function( event, ui ) {
alert("aha!");
return false;
}
});
</script>
body
<input id="membersearch" /> <--- autocomplete field
<div id="memberfocus"></div> <-- where I will display the results
data from members.asp
[{"fullname":"USERNAME1","id":"ID1"},{"fullname":"USER NAME2","id":"ID2"},.... {"fullname":"USER NAME1000","id":"ID1000"}]
The pertinent fields are id and fullname. fullname should be seen in the autocomplete list, id is the hidden submitted/stored value.
As I said, at this stage the autocomplete list isn't even appearing anymore and I've tried so many things in the last 3 days my head is swimming.
TIA,
Jay
PS I hope I picked the right forum for this post