Answer the question
In order to leave comments, you need to log in
How to "remove" return from a function in Django?
Hello.
There is a button on the page that calls the function of creating a new element (I do it via Ajax).
You need to make sure that a new element is created, but there is no new render, redirect, and so on. those. on which page a person clicks, on that one he remains.
Those. how to specify it in a function? Remove return, set an empty value in it? Tell.
Answer the question
In order to leave comments, you need to log in
This is done in js. Where you have event handling, should be e.preventDefault() if you are using jQuery, or just return false
Since there is no code, we can only guess.
My guess is that the button is inside a form and is considered a submit. To prevent submit, add type="button"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question