I get form from view and form classes, and then use code
to insert the form into a modal. But this line always throw browser console warning
“Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/”
I tried every single of suggestions I found from Internet and chatGTP, but none is able to make the warning go away.
I really suspect the django-select2 and modal combination will always generate the warning. Anyone has experience about this combination and can confirm?
I tried using standalone select2, and it didn’t give the same warning. But I read django-select2 has huge performance benefit when traffics are heavy, which standalone select2 cannot give.
Is it possible the warning is because of a modal itself is a “Synchronous” and generated the warning? If so, okay to ignore the warning?
Note: This appears to be a duplicate of your post on this topic from last week. Please do not repost inquiries on the same subject. If you have additional data to supply, add it as a reply to the original post.
Thanks for your response.
The reason I have separate post because my focus is not the same. Previous one was mainly asked how should I asynchronously retrieve data. This one is about if django-select2 + modal a problematic combination. I want to see if django-select2 is still the best option if I use modal.
Those are two separate topics.
The use of django-select2 is separate from and independant of any modal operation.
Any issue you are encountering is an issue of one or the other - the combination itself is not problematic.
The reason I said that was because the fact that when I used modal without apply django-select2 to that field, it worked as regular dropdown and didn’t generate that warning; when I used that field with django-select2 on a regular page, not modal, it worked too as a select2 style field and had no warning. That made me feel my usage of modal or select2 field was not a problem.