Hi All,
How can I redirect to selected URL after I select one record from the autocomplete dropdown list? do you have an example? This is the link that I am working to have a better idea: http://www.calgaryguide.net/ForumCommunityNewsLifeInformation.php
here is the code:
This is the routine that call getautocomplete.php
<!-- Autocomplete rutina - Inicio -->
<meta charset="utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
<script type="text/javascript">
$(document).ready(function(){
$("#nameAutoComplete").autocomplete({
source:'getautocomplete.php',
minLength:1
});
});
</script>
<!-- Autocomplete rutina - End -->
This is the HTML:
<label>Subject:</label>
<input type="text" id="nameAutoComplete" name="nameAutoComplete" size="25" />
This is the file getautocomplete.php
[php]
<?php // 1. Conexion.. include("Includes/ConnectionRouter.php"); $term=$_GET["term"]; $query=mysql_query("SELECT * FROM headerForums where subjectnews like '%".$term."%' AND language='EN' AND forumType= 'CO' order by subjectnews "); $json=array(); while($subjects=mysql_fetch_array($query)) { $json[]=array( 'id'=> $subjects["linkurl"], 'value'=> $subjects["subjectnews"], 'label'=>$subjects["subjectnews"]." - ".$subjects["regisdate"] ); } echo json_encode($json); ?>[/php]
Thanks in advance for your help.