No result after yield two selection

itisrama's Avatar


16 Apr, 2010 09:29 AM

hi i have a problem with AutoSuggest, JSON and MySQL query work fine but everytime the AutoSuggest had yielded two data, the rest will only yield no result found... I have tried using different table but the same result.

This is my php file


$input = $_GET["q"];
$data = array();
$query = mysql_query("SELECT name FROM pbook WHERE name LIKE '%$input%'");
while ($row = mysql_fetch_assoc($query)) {
    $json = array();
    $json['name'] = $row['name'];
    $data[] = $json;
header("Content-type: application/json");
echo json_encode($data);


And this is my HTML + Javascript

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">



  1. 1 Posted by itisrama on 16 Apr, 2010 09:31 AM

    itisrama's Avatar

    sorry... this is the Javascript file :

        $(".destination input").autoSuggest("http://localhost/script/search_result.php", 
        {selectedItemProp: "name", searchObjProps: "name", startText: "Search contact", emptyText: "No contact found, insert number instead"});
  2. 2 Posted by grega on 21 Apr, 2010 12:25 PM

    grega's Avatar

    I'm experiencing the same issue. Using Firebug I can see that just like the first two selections, the third request is sent and the JSON is returned, however autoSuggest displays "No Results Found". Works perfectly for the first two selections and then nothing on the third.


        $("#q").autoSuggest("/ajax/suggestions/", {
            selectedItemProp: "name",
            searchObjProps: "name",
            minChars: 2

    I'm using Django on the server side:

    def suggestions(request):
        query = request.GET.get('q', None)
        data = []
        if query:
            for location in Location.objects.filter(Q(suburb__icontains=query)):
                json_data = {}
                json_data['id'] =
                json_data['name'] = location.suburb
        response = HttpResponse()
        response['Content-type'] = "application/json"
        return response
  3. 3 Posted by grega on 21 Apr, 2010 03:05 PM

    grega's Avatar

    For anyone else experiencing this behavior, adding selectedValuesProp appears to fix it. Working perfectly now.


        $("#q").autoSuggest("/ajax/suggestions/", { 
            selectedItemProp: "name",               
            selectedValuesProp: "id",
            searchObjProps: "name",
            minChars: 2

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • Error.PNG 7.09 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac