Existing Jquery autocomplete code Posts Null Ref Jquery 1.9.1 Upgrade

Existing Jquery autocomplete code Posts Null Ref Jquery 1.9.1 Upgrade

 
  1. $(function(){
  2.     var searchRequest = null;
  3.     $("#asksomething").autocomplete({
  4.         minLength: 3,
  5.         highlightItem: true,
  6.         multiple: true,
  7.         multipleSeparator: " ", 
  8.         source: function(request, response) {
  9.             if (searchRequest !== null) {
  10.                 searchRequest.abort();
  11.             }
  12.             searchRequest = $.ajax({
  13.                 url: window.location.origin+'/cgi-bin/cgi-lib/autocomplete.pl',
  14.                 method: 'POST',
  15.                 dataType: "json",
  16.                 data: { searchterms: request.term },
  17.                 success: function(data) {
  18.                     searchRequest = null;
  19.                     if (data)
  20.                     {
  21.                         response($.map(data, function(item) {
  22.                             return {
  23.                                     value: item.id,
  24.                                     label: item.question
  25.                                 };
  26.                             }));
  27.                     }
  28.                 }
  29.             }).fail(function() {
  30.                 searchRequest = null;
  31.             });
  32.         },
  33.         select: function(event, ui) {
  34.             selectQuestion(ui.item.value);
  35.             ui.item.value="";
  36.         }
  37.     });
  38. });

The following code will not work now that I have upgraded to Jquery 1.9.1 (from 1.8.3) in order to use Twitter Bootstrap.

The "searchterms" are not being passed the script, the script gets a null ref.

This is JQueryUI 1.9.2

I also get an error from the javascript :
SyntaxError: Unexpected end of input