How to Load data using jQuery AJAX in Select2 – Laravel 8

preview_player
Показать описание
This video shows how you can load MySQL database data in select2 using jQuery AJAX in Laravel 8 project.

0:34 - Update database configuration.
0:43 - Create table
2:08 - Create Model
2:49 - Create Controller
6:22 - Create Route
7:43 - Create View
11:49 - Run the project

Subscribe for more tutorials:

Stay Connected With Us:
Рекомендации по теме
Комментарии
Автор

I would like to ask you how to programmatically select a value using the Id retrieved via ajax call. Following the select2 guide I used the following code "$ ('# select2_id'). Val ('1');
$ ('# select2_id'). trigger ('change'); "but the field remains empty! I think it's because the options are loaded only when the ajax call starts on the click of select2. Can you suggest me a way to solve?

davidemancosu
Автор

Dear friend, does this work on Laravel 7 ?

techtop
welcome to shbcf.ru