Existing Jquery autocomplete code Posts Null Ref Jquery 1.9.1 Upgrade
- $(function(){
- var searchRequest = null;
- $("#asksomething").autocomplete({
- minLength: 3,
- highlightItem: true,
- multiple: true,
- multipleSeparator: " ",
- source: function(request, response) {
- if (searchRequest !== null) {
- searchRequest.abort();
- }
- searchRequest = $.ajax({
- url: window.location.origin+'/cgi-bin/cgi-lib/autocomplete.pl',
- method: 'POST',
- dataType: "json",
- data: { searchterms: request.term },
- success: function(data) {
- searchRequest = null;
- if (data)
- {
- response($.map(data, function(item) {
- return {
- value: item.id,
- label: item.question
- };
- }));
- }
- }
- }).fail(function() {
- searchRequest = null;
- });
- },
- select: function(event, ui) {
- selectQuestion(ui.item.value);
- ui.item.value="";
- }
- });
- });
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