Yes that's possible since you are using Ajax. It should be something like this:
$.ajax({url: '{% url "xxxx" %}',data: {'xxxxx': xxxx,},dataType: 'json',success: function (data) {if (data.added_item) {item = data.added_item$("#selectListID").append(item);}}});
On Mon, May 25, 2020, 4:12 PM Sherif Adigun <adigunsherif@gmail.com> wrote:
I have a form which has a select field (your color). In front of the select field, I have a button that produces a popup which allows users to create new color before they submit. I am submitting that color form via Ajax. After adding a new color to the database, the popup closes.
I want the newly added color to show in the select list without reloading the page.
Is this possible?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f176d90-93e3-40f8-b02f-4d27b6b55a75%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHyB84oZYZPeaokwWduQDJsnVXxSE4HYumAMGw1%3DgmVTPgyhWA%40mail.gmail.com.
No comments:
Post a Comment