L
L
La2ha2012-12-08 08:24:17
PHP
La2ha, 2012-12-08 08:24:17

FireFox - how to cancel page exit warning?

There was a problem in Firefox.
There is a form, sending occurs via ajax without using .submit () i.e. when clicking on a specific button. an ajax request is executed, after which a redirect can be performed.
So, before performing the redirect, FireFox asks:

This page asks you to confirm that you want to leave - the data you entered may not be saved.

You need to somehow get rid of this, using the submit () event in which this message could be disposed of is not entirely suitable.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
T
theaspin, 2012-12-08
@La2ha

And precisely events on onbeforeunloaddoes not hang?

A
Alexander Kouznetsov, 2012-12-08
@unconnected

how is the redirect done? and where does it lead - in the same domain or somewhere to the side?

G
Gleb Starkov, 2012-12-08
@colonel

If you do not need submit via form, then remove it altogether, leave only the fields (input, etc.), it should help.
I work with almost all forms through ajax, I have not seen such a problem.
And by the way, in your case it's more convenient to use $.post:

$.post(url, data, function(data){
    /*success here*/
}, 'json');

L
La2ha, 2012-12-08
@La2ha

Thank you, if the problem was exactly in the form (as I originally assumed), then your solution would help. I just thought that .serialize() only works for forms, because. the documentation only talks about them api.jquery.com/serialize/ , but now I googled it and it turned out that everything can be applied, sort of.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question