S
S
Sergey Nizhny Novgorod2016-07-07 13:54:55
Django
Sergey Nizhny Novgorod, 2016-07-07 13:54:55

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

2 answer(s)
I
Ilya, 2016-07-07
@FireGM

This is done in js. Where you have event handling, should be e.preventDefault() if you are using jQuery, or just return false

M
Maxim Vasiliev, 2016-07-07
@qmax

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 question

Ask a Question

731 491 924 answers to any question