I am using the select2
4.0.2 plugin to implement a select box that performs an AJAX search. However, I would like the options to display within <option>
tags initially, similar to a regular <select>
, until the user starts typing. At that point, I want the system to send an AJAX request to the server for further searching when the query string is not empty.
The main issue here is that the AJAX search process is somewhat slow, but I can preload the initial result on page load. Instead of loading them as <option>
s, I could alternatively store them in a JSON array or another format.