I am using Select2 version 4.0.0 and trying to load remote JSON with a PHP script that returns the already generated data that I need. The problem is that the forces of darkness are doing something, because I just canβt send a request, there is no error, but there is no request sent, it is just as quiet as the devil that I almost cry!
I use LiveScript and Jade as alternatives to JavaScript and HTML, but I will translate here.
First, my markup defines a selectable field:
<select id="satan-hates-me"></select>
Then I can make it look like a selectable item:
$("#satan-hates-me").select2({ placeholder: "Hail", minimumInputLength: 1, ajax: {
I do this, wrapped in a download function, after loading the page it looks like selectable, but does not send any requests, and the script returns me the exact format needed, for example
[{id: 1, text: "Sadness"}, {id: 2, text: "Depression"}]
And here it goes. I can design compilers, but I cannot make a plug-in with Ajax in the world! Can someone help me please?
javascript jquery ajax jquery-select2
Marcelo camargo
source share