How to send a form with Targe Blank and redirect the current page without Crhome blocking?

Asked

Viewed 72 times

0

I have the following scenario:

In a form send the data via Ajax, at the time of return if:

if (json.retorno == true){
  $("#form_imprime").submit();
}

If I put a button in the form and send via the click of this button it opens another window and the browser does not complain, but if I try to send via ajax it blocks saying it is popup, then it will only open if the guy release the popup.

Turns out it’s not quite a popup is a new page so much is that by the button it goes.

I know that this popup blocking of browsers is normal, but there is a solution in this case, without the user having to intervene?

I have this need because users who will use the system have no experience and unlock the popup will be a birth for them.

In short I need the following:

0 - O usuario seleciona um horario e é enviado para outra pagina
1 - Nessa outra pagina esta o formulario entao gravar os dados do formulario (via ajax)
2 - Abrir um tela de impressão com os dados gravados
3 - Redirecionar a pagina do formulario para uma pagina anterior

I already have this system working in an old way, but this very obsolete, I’m changing to ajax and found this difficulty.

  • 1

    I really don’t think you can do this. You could do this: after the data is recorded via ajax, you show a "Print" button that when clicked, opens the popup and at the same time redirects. So the browser won’t block. And you don’t even need to make a request, just use the same form data in the print window.

  • Good tip Sam, now I came across another need, I used jquery’s modals and in it I could leave the locked screen only giving button close option, now the designer used bootstrap modal, in it if the guy click outside the message div the message closes, Then the guy loses the option to print what he can’t, like lock to not close the modal if it is not clicked on the print button?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.