0 votes

Onclick to send information

I have a button with the click event I need to perform basically as the action of an href, since by using a link to send information to another page, however I want to run and instead open a new window to open an alert saying process completed, and keep me on the same page.

<button type="submit" onclick= "window.open('http://53.18.19.1/module/ps_buybuttonlite/RedirectManager?id_product=23&action=1&id_product_attribute=null','_blank')">ENVIAR DATOS</button>

1voto

Dickie Head Points 51

You could send a message of type alert, not sure if it is what you need. I leave an example :)

<button type="submit" href="http://53.18.19.1/module/ps_buybuttonlite/RedirectManager?id_product=23&action=1&id_product_attribute=null" onClick='alert("Compra agregada!")'>ENVIAR DATOS</a>

It is just an idea.I hope that help you!

1voto

Daniel Ascencio Points 33

Thanks to help me to guide me, I resolved this issue by loading the href into an iframe with display: none, so he lifted the alert, and executing the href without leaving the page.

<iframe name="show" style="display: none;"></iframe>

<a href="http://www.misitio.com/RedirectManager?id_product=80&action=1&id_product_attribute=null" class="btn btn-success" onclick='alert("Compra agregada!")' target="show">AGREGAR</a>

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X