X
X
xidios2020-09-25 23:18:19
JavaScript
xidios, 2020-09-25 23:18:19

How to stay on the same page after clicking on the publish button?

5f6e507debe7d163242154.pngAfter clicking on the button, the page redirects to another one, is there any way to prevent this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Diatomiccoder, 2020-09-26
@xidios

You can listen to the form's submit event and call event.preventDefault() internally. This will cancel sending the request (accordingly, there will be no redirect either), so you will have to send the ajax request yourself.

A
Artem Pyvovar, 2020-09-25
@art9mid

Remove redirect or remove button event

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question