src/hg/js/autocomplete.js 1.2

1.2 2010/02/09 08:51:30 larrym
../cgi-bin/suggest => ../cgi-bin/hgSuggest
Index: src/hg/js/autocomplete.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/autocomplete.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 1000000 -r1.1 -r1.2
--- src/hg/js/autocomplete.js	6 Feb 2010 01:19:35 -0000	1.1
+++ src/hg/js/autocomplete.js	9 Feb 2010 08:51:30 -0000	1.2
@@ -1,50 +1,50 @@
 // support stuff for auto-complete using jquery.autocomplete.js
 //
 // requires ajax.js
 // requires utils.js
 
 var suggestCache;
 
 function ajaxGet(getDb, cache)
 {
 // Returns jquery.autocomplete.js ajax_get function object
-// getDb should be a function which returns the relevant assembly (e.g. "hg18)
+// getDb should be a function which returns the relevant assembly (e.g. "hg18")
 // cache is an optional object used as a hash to cache responses from the server.
     suggestCache = cache;
     return function (key, cont) {
         if(suggestCache == null || suggestCache[key] == null)
         {
             $.ajax({
-                       url: "../cgi-bin/suggest",
+                       url: "../cgi-bin/hgSuggest",
                        data: "db=" + getDb() + "&prefix=" + key,
-                       // dataType: "json",  // XXXX this doesn't work under IE.
+                       // dataType: "json",  // XXXX this doesn't work under IE, so we retrieve as text and do an eval to force to an object.
                        trueSuccess: handleSuggest,
                        success: catchErrorOrDispatch,
                        error: function (request, status, errorThrown) {
                            if (typeof console != "undefined") {
                                console.dir(request);
                                console.log(status);
                            }
                            var msg = "ajax call failed";
                            if(status != "error")
                                msg = msg + "; error: " + status;
                            showWarning(msg + "; statusText: " + request.statusText + "; responseText: " + request.responseText);
                        },
                        key: key,
                        cont: cont
                    });
         } else {
             cont(eval(suggestCache[key]));
         }
         // showWarning(request.term);
     }
 }
 
 function handleSuggest(response, status)
 {
     // We seem to get a lot of duplicate requests (especially the first letters of words),
     // so we keep a cache of the suggestions lists we've retreived.
     if(suggestCache != null)
         suggestCache[this.key] = response;
     this.cont(eval(response));
 }