i m using auto suggest using Ajax Json .
now when a user select a user name , i want to send user on the link of that user name
my json data is coming in this way
{
query:'hel',
suggestions:["hello world","hell boy ","bac to hell"],
data:["2","26","34"]
}
now what i want that user goes to http://userProfile.php?uid=26
on select username(suppose user select "hell boy")
how to do this??
UPDATE: i describe what i m doing step by step i m using a searchbox using jquery ajax, when user write some text on input box , we show (suggest) value regarading their search
STEP 1. when user write atleast(2 letter) <input type="text" name="q" id="query" />
then a function(below) in invoked in which i send the value written on text box(eg. hell).
<script type="text/javascript" language="javascript">
var options, a;
jQuery(function(){
options = { serviceUrl:'rpc.php' };
var a = $('#query').autocomplete({
serviceUrl:'rpc.php',
minChars:3,
delimiter: /(,|;)\s*/, // regex or character
maxHeight:400,
width:300,
zIndex: 9999,
deferRequestBy: 0, //miliseconds
});
});
</script>
STEP 2: on rpc.php
, i collect the data and show using JSON
my final data come in below format
{
query:'hell',
suggestions:["hello world","hell boy ","bac to hell"],
data:["2","26","34"]
}
where suggestion list having username and data is userid( from user_tables). above data comes in a div (on frontend) where user name displayed in a list
STEP 3: now if i select any username using uparrow, downarrow then that name is filled in input box,
STEP 4: now what i want that when user select usename then page automatically goes to that user's profile section ( userprofile.php?uid=2
)