Hi, i got a Ajax Autocomplete script from script.aculo.us (http://wiki.script.aculo.us/scriptaculous/show/Autocompleter.Local) that works well.
However, I want the suggested results to have links on it (just like in Yahoo Answers). Both the suggested results text and links would be coming from a database.
I'm not having any luck in attempting to do this. Please help me! I've been researching on this through google and i've been to tons of sites.... If somebody would be able to fix this for me, i'd really be greateful!
Here's the script:
<script src="lib/prototype.js" type="text/javascript"></script>
<script src="src/scriptaculous.js" type="text/javascript"></script>
<script src="src/unittest.js" type="text/javascript"></script>
<form id="addForm" method="POST">
<p><label>Enter Full/Partial Name:
<input name="QuestionA" type="text" id="QuestionA" value="" size="65" autocomplete="off" />
</label>
<div id="QuestionAupdate" style="display:none;border:1px solid black;background-color:white;"></div>
<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[
new Autocompleter.Local('QuestionA','QuestionAupdate',
new Array("search result 1", ""<?php // Get the Search Results Data
$query = "SELECT * FROM c3_member, c1_user, c6_expert, specialty WHERE c1_user.iduser = c3_member.idmem AND c3_member.idmem = c6_expert.idexp AND c6_expert.idfield_1 = specialty.idspec";
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) { // Start the loop
echo ', "", "' . $row['iduser'] . ' - ' . $row['username'] . ' - ' . $row['first_name'] . ' ' . $row['middle_name'] . ' ' . $row['last_name'] . ' ' . $row['jr'] . ' - ' . $row['specname_med'] . '"';
} // End of while loop. ?>, "search result 3", "", "search result 4"), { tokens: new Array(',','\n'), fullSearch: true, partialSearch: true });
// ]]>
</script>
</p></form>
[/B]
The above script works well.... except that the search results are not links yet.
In the above script, i'd like to have each Search Result Line to be a link. And the link would also be an AJAX link. The Link would be targetting a DIV. Below is how the link should be formatted.
<a href="javascript:ajaxpage('FileName.php', 'DIVname');">Link</a>
Please help. I'm confident that the people in this community would be able to find a solution and would help a desperate person in need.
Thanks in Advance!