Reload data via Ajax into Lightbox


#1

Hello,

I have a lightbox with a text field Name and First Name. When the user opens the lightbox he writes in the field Name. Starting with the third character data from the database should be loaded via Ajax.

Is this possible?

Because there is a lot of data, I don’t want to send all data during the initialization.

THANK YOU
Ciao Thomas


#2

Hi Thomas,

It’s possible, but you may need to implement a custom text input.
The simplest solution would be to use a ready third-party control that supports autocomplete and ajax loading, for example, jquery select2 https://select2.org/

You’ll be able to use it inside the lightbox by wrapping it with the lightbox control interface:
Docs: https://docs.dhtmlx.com/scheduler/custom_lightbox_editor.html
Sample: http://snippet.dhtmlx.com/5/fb8e29d76

And then you should be able to enable server-side loading of values for select2 and implement the backend:
https://select2.org/data-sources/ajax