Skip to content

Example doesn't work #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Mykyta-Chernenko opened this issue Mar 9, 2018 · 0 comments
Closed

Example doesn't work #46

Mykyta-Chernenko opened this issue Mar 9, 2018 · 0 comments

Comments

@Mykyta-Chernenko
Copy link

Mykyta-Chernenko commented Mar 9, 2018

jquery.js, materialize.min.js, jquery.materialize-autocomplete I included all of these packages, Styles are included as well, but nothing appears if i copy the example. I just get no autocomplete and no errors.
When I tried to use it a bit changed, i get autocomplete with corrupted files.

var autocomplete = $('#symptoms').materialize_autocomplete({
limit: 20,
multiple: {
enable: true,
maxSize: 10,
},
appender: {
el: '#someEl'
},
getData: function (value, callback) {
console.log('sympt')
data = [];
$.ajax({
"type": "POST",
"dataType": "json",
"url": "{% url 'symptoms-autocomplete' %}",
"data": {'name': $('#symptoms').val()},
"success": function (result) {

                        for (var i = 0; i < result.length; i++) {
                            data[i] = {'id': result[i]['id'], 'text': result[i]['name']}
                        }
                        console.log(data);
                        callback(value, data);
                    },
                    "error": function (error) {
                        console.log(error);
                        callback(value, data);
                    }
                });

            }
        });

data that is passed have format at it's said it the docs.
screenshot from 2018-03-09 17-25-38
if i click on the dropdown it disappears and doesn't populate the field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant