StevenDevooght / tinyMCE-mention

Mention/Autocomplete plugin for tinyMCE WYSIWYG editor.
http://stevendevooght.github.io/tinyMCE-mention/
220 stars 95 forks source link

$getJSON() not working #89

Open marmz opened 2 years ago

marmz commented 2 years ago

I tried to put the same source of demo in an external file:

mentions.json

code:

[
        { name: 'Tyra Porcelli' }, 
        { name: 'Brigid Reddish' },
        { name: 'Ashely Buckler' },
        { name: 'Teddy Whelan' }
]

then fetch it like suggested:

code:

mentions: {
    source: function (query, process, delimiter) {
        // Do your ajax call
        // When using multiple delimiters you can alter the query depending on the delimiter used
        if (delimiter === '@') {

           $.getJSON(baseurl+'mentions.json', function (data) {
              //call process to show the result
              process(data);
           });

        }
    }
}

No errors in console but, when pressing "@", i got an empty popup.. Any ideas?

PS: When loading items with source (without using $.getSON for external file) everything works fine.