documentcloud/visualsearch — Issue #31: AJAX powered callback data incorrect ordering
Author: jbrooksuk
Created: 2011-10-12 11:59:43+00:00
State: open

Within my switch, I've cased a few values together and used the `searchTerm` variable to narrow down my search.

The code use to do my AJAX request is the following:

var cCountry = category.toLowerCase().replace(" ", "");

$.get('api/hotels.php', {
c: cCountry,
h: searchTerm
}, function(hSuggest) {
// console.log(hSuggest);
callback(hSuggest);
}, "json");

Which works fine, all data is passed into the suggestions. The `hotels.php` page specifies an `ORDER BY name ASC` which when viewing the output normally works fine, yet the suggestions always seem to have one item which is not alphabetically ordered at the top.

You can see a picture [here](http://dl.dropbox.com/u/7323096/VisualSearchItem.png).