D
D
Dos2020-05-10 20:31:29
JavaScript
Dos, 2020-05-10 20:31:29

What could be wrong with Select2?

jQuery.Deferred exception: undefined is not an object (evaluating 'data.slice')
5eb83a6f8cdce019898852.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexalexes, 2020-05-10
@pro-dev

The slice() array method is applied to the data variable, but at this moment data is not an array (it is also an object in the understanding of JS).
Such errors occur when, before processing the array, they forget to register exceptional conditions, when the data object can be formed not as an empty array, but, for example, may contain error information passed from the abstraction layer, which normally generates data as an array .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question