Welcome Guest, Not a member yet? Register   Sign In
Creating an auto-suggest field with jQuery
#30

[eluser]hi8is[/eluser]
I am having the same trouble - outside of code igniter.

The auto suggest works - it just doesn't fill in my form when you click on an auto suggest item.

PHP Code:
<?php

// Datebase varibles
$db_host = "localhost";
$db_user = "user";
$db_pass = "pass";

// Esstablish connect to MySQL database
$con = mysql_connect( $db_host, $db_user, $db_pass);
if(!$con)
die('Could not connect: ' . mysql_error() );

mysql_select_db("mydb", $con);

if(isset($_POST['queryString'])) {
$queryString = $_POST['queryString'];
if(strlen($queryString) >0) {
$query = "SELECT DISTINCT english as english from cats where english LIKE '$queryString%'";
$result = mysql_query($query) or die("There is an error in database please contact [email protected]");
while($row = mysql_fetch_array($result)){
echo '<li>'.$row[english].'</li>';
}
}
}
?&gt;

It returns results and shows them - so I know that the PHP is not the issue.

The jQuery:
[removed]

function lookup(inputString) {
if(inputString.length == 0) {
// Hide the suggestion box.
$('#suggestions').hide();
} else {
$.post("rpc.php", {queryString: ""+inputString+""}, function(data){
if(data.length >0) {
$('#suggestions').show();
$('#autoSuggestionsList').html(data);
}
});
}
} // lookup

function fill(thisValue) {
$('#search').val(thisValue);
$('#suggestions').hide();
}

[removed]

Again - the results are shown but when I get down to the fill(thisValue) function - it doesn't do anything upon clicking a value.

Here is my form HTML:
&lt;form action="results.php" method="get" name="searchForm"&gt;
&lt;input name="search" id="search"&gt;
<a href="#" class="clickHere">*click here to post a new or used car part for sale - <u>it’s free.</u></a>
&lt;input name="" value="" type="submit" class="searchBtn"/&gt;
<div class="suggestionsBox" id="suggestions" style="display: none;">
<div class="suggestionList" id="autoSuggestionsList">
</div>
</div>
&lt;/form&gt;

It'd be great if someone gets us over the goal line - I share your frustration.

If I figure anything out, I'll let you know. =(

Help - please. =)

The site in question is www.car-parts-now.info/aman/index2.php


Messages In This Thread
Creating an auto-suggest field with jQuery - by El Forum - 01-17-2011, 04:21 AM
Creating an auto-suggest field with jQuery - by El Forum - 01-18-2011, 03:33 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-18-2011, 04:37 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-18-2011, 05:28 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-18-2011, 05:36 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-19-2011, 03:09 AM
Creating an auto-suggest field with jQuery - by El Forum - 01-19-2011, 03:58 AM
Creating an auto-suggest field with jQuery - by El Forum - 01-19-2011, 04:11 AM
Creating an auto-suggest field with jQuery - by El Forum - 01-19-2011, 01:43 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 12:06 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 01:40 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 01:44 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 01:51 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 02:34 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 03:16 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 03:47 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 04:12 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 04:35 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 04:47 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 05:01 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 05:06 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 05:17 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-20-2011, 05:45 PM
Creating an auto-suggest field with jQuery - by El Forum - 01-21-2011, 03:07 AM
Creating an auto-suggest field with jQuery - by El Forum - 01-21-2011, 08:59 AM
Creating an auto-suggest field with jQuery - by El Forum - 02-01-2011, 10:54 AM
Creating an auto-suggest field with jQuery - by El Forum - 02-01-2011, 02:44 PM
Creating an auto-suggest field with jQuery - by El Forum - 02-01-2011, 02:47 PM
Creating an auto-suggest field with jQuery - by El Forum - 02-01-2011, 02:55 PM
Creating an auto-suggest field with jQuery - by El Forum - 02-04-2011, 01:49 AM
Creating an auto-suggest field with jQuery - by El Forum - 02-04-2011, 08:35 AM
Creating an auto-suggest field with jQuery - by El Forum - 02-04-2011, 09:34 PM
Creating an auto-suggest field with jQuery - by El Forum - 02-05-2011, 10:23 AM
Creating an auto-suggest field with jQuery - by El Forum - 02-05-2011, 06:06 PM
Creating an auto-suggest field with jQuery - by El Forum - 02-05-2011, 09:26 PM
Creating an auto-suggest field with jQuery - by El Forum - 02-10-2011, 03:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB