Reload Select2 widget after create a user by Modal


I have a form where I select a customer by Select2 widget , but if the customer does not exist is created through a Modal.

I need you at the time the Modal is closed and the customer is created, can now select the new customer in Select2 widgets

I hope you can help.

Yes. You need to use ajax to update the select options when the customer is created. Let jQuery handle that based on the ajax response. After the customer is added, you may provide the options for the new customer which you can append to the existing select options.

I don’t know what is a select2 widget, but this logic should work.