[TYPO3-english] Problems with the extension comsolit suggest - javascript error

Anselmo Cotellessa web at vah.de
Tue Apr 10 13:29:28 CEST 2018


I have Problems with the extension comsolit suggest. There is a javascript error SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data. I use bootstrap as well an integrated also the jquery libary jquery-1.9.1.min.js the date in the script stays empty

I use typo3 8.7.11 and integrated all includes including indexed_search based and fluid and comsolit_suggest. the pages have been indexed. Can anyone help me with this issue?

Here is the ajaxcode:

$(document).ready(function(){
                var suggester = new Bloodhound({
                    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
                    queryTokenizer: Bloodhound.tokenizers.whitespace,
                    remote: {
                        cache: 'false',   
                        url: '/?type=999&no_cache=1&tx_comsolitsuggest_suggest[search]=%QUERY&tx_comsolitsuggest_suggest[method]=suggest',
                        wildcard: '%QUERY',
                        transport: function (ajaxOptions, onSuccess, onError) {
                            ajaxOptions.dataType = "html";
                            $.ajax(ajaxOptions).done(done).fail(fail);
                   
                            function done(data, textStatus, request) {
                         
                                onSuccess(JSON.parse(removeHTML(data))); //hier tritt der Fehler auf
                              }
                   
                              function fail(request, textStatus, errorThrown) {
                                  onError(errorThrown);
                              }
                          }
                    }
                });
                suggester.initialize();
                $('.typeahead').typeahead({
                    hint: true,
                    highlight: true,
                    minLength: 1,
                }, {
                    limit: 10,
                    displayKey: 'value',
                    source: suggester.ttAdapter()
                })
                .on('typeahead:selected', function(e){
                    e.target.form.submit();
                   });
                function removeHTML(input){
                    return input.replace(/<\/?[^>]+>/gi, '');
                }
            });



More information about the TYPO3-english mailing list