سؤال

I am making an application that is purely out of JavaScript (frontend and backend). So now I am using jQuery.tokenInput.js and I am having some troubles with the plugin recognizing the script.

First of all, it's not logging any error messages so I don't even know if it's an issue on my end or not.

I've essentially created a route in the application /autocomplete/tags and it accepts q parameter as well.

So when I type in something like this /autocomplete/tags?q=r I get the following result on the page

[{"tag_name":"Android","_id":"ooJaBpZ6MShmzbshY"},{"tag_name":"RPG","_id":"KpvAqCRqKKP5rbGLD"}]

So now when I initialize the plugin like this

$('#tag_input').tokenInput("/autocomplete/tags", {
            theme: "facebook",
            propertyToSearch: "tag_name",
            tokenLimit: 5
        });

It changes the input and everything. I've even tried with constant data and it seems to work but not with a script for some reason.

Is there a way I can debug/troubleshoot? Can I somehow turn on logging for this plugin? I don't actually see any issue with the way that I am doing it. I've looked at the demos and they return JSON in exactly the same way.

If you've got any ideas, it would be great!

هل كانت مفيدة؟

المحلول

The JSON returned from an external service must be returned under an application/json header type - we found that this service was returning text/html instead.

Information about how to specify the content type with Meteor can be found on this question.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top