• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating an auto-suggest field with jQuery

#21
[eluser]Mike DeFelice[/eluser]
Hmm everything does seem fine, even when I plugged in your last bit it seemed to work. I am stumped.

#22
[eluser]Wayne Smallman[/eluser]
[quote author="Mike DeFelice" date="1295586384"]Hmm everything does seem fine, even when I plugged in your last bit it seemed to work. I am stumped.[/quote]Not much hope for me then! Ha!

I've just dropped the jQuery into BBEdit and zapped gremlins, just in case there were any stray characters in there, but that's not changed anything.

I also tried a different web browser, just in case that was an issue, but no change there, either.

Thanks again for all your time on this!

#23
[eluser]Mike DeFelice[/eluser]
I'm very sorry I could not be more of a help, I usually include the jquery from googles cdn.

http://ajax.googleapis.com/ajax/libs/jqu...ery.min.js

That way I know it's always delivered nice and fast. If you ever can work out it, I would love to know what the problem was.

#24
[eluser]Wayne Smallman[/eluser]
[quote author="Mike DeFelice" date="1295588736"]I'm very sorry I could not be more of a help, I usually include the jquery from googles cdn.

http://ajax.googleapis.com/ajax/libs/jqu...ery.min.js

That way I know it's always delivered nice and fast. If you ever can work out it, I would love to know what the problem was.[/quote]I just tried using that instead of the hosted version I'm using, but not change.

So frustrating because it's so damn close to working!

Mike, thanks for all the effort, and all the best.

#25
[eluser]Mike DeFelice[/eluser]
No problem at all, if you want to message me maybe I can see where the error lies in the coding.

#26
[eluser]Victor Michnowicz[/eluser]
This is my first video tutorial. Hopefully it is not too rough around the edges. It covers creating CI2 jQuery & JSON search suggestions. It even highlights the search string for ya:

http://www.vmichnowicz.com/blog/entry/co...uggestions

#27
[eluser]Wayne Smallman[/eluser]
[quote author="elvicmic" date="1296600858"]This is my first video tutorial. Hopefully it is not too rough around the edges. It covers creating CI2 jQuery & JSON search suggestions. It even highlights the search string for ya:

http://www.vmichnowicz.com/blog/entry/co...uggestions[/quote]Hi and thanks for the video!

Thing is, I'm loathed to jump into Reactor out of CodeIgnitor proper just for the sake of an auto-suggest tool.

Especially at this stage in the project. But thanks all the same. I'm sure others will find the video useful.

#28
[eluser]Victor Michnowicz[/eluser]
Official CI2 will work just as well. And even 1.7 I'm pretty sure. All you gotta do is define an IS_AJAX constant.

#29
[eluser]Wayne Smallman[/eluser]
[quote author="elvicmic" date="1296614833"]Official CI2 will work just as well. And even 1.7 I'm pretty sure. All you gotta do is define an IS_AJAX constant.[/quote]I think I'm using 1.7.

If I have time later, I'll give your technique a try. Right now, I'm furrowing a brow over something more fundamental to the application I'm developing.

#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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.