Veronica20_qro
Veronica20_qro

Reputation: 85

How to refresh my php page: onclick

I need to refresh my php. page after my onclick, but in the on click i have to send some values Is it posible?

this is my code:

<a class="btn btn-warning btn-sm" href="" onclick="this.href='insertaCotizacion.php?pais=' + document.getElementById('pais').value + '&proyecto=' + document.getElementById('proyecto').value + '&notas=' + document.getElementById('notas').value + '&formapago=' + document.getElementById('formapago').value + '&fechaentrega=' + document.getElementById('fechaentrega').value + '&flete=' + document.getElementById('flete').value + '&instalacion=' + document.getElementById('instalacion').value + '&venta=' + document.getElementById('venta').value + '&total=' + document.getElementById('total').value; return true/*I WANNA REFRESH MY PAGE HERE*/">Realizar</a> //

I saw it, but i dont understand

Upvotes: 1

Views: 1925

Answers (2)

LTasty
LTasty

Reputation: 2008

if you need to reload page with params use window.location.href

Example:

    <html>
    <head>
    <script>
    function reloadUrl(){
     var url=insertaCotizacion.php?pais=' + document.getElementById('pais').value + '&proyecto=' + document.getElementById('proyecto').value + '&notas=' + document.getElementById('notas').value + '&formapago=' + document.getElementById('formapago').value + '&fechaentrega=' + document.getElementById('fechaentrega').value + '&flete=' + document.getElementById('flete').value + '&instalacion=' + document.getElementById('instalacion').value + '&venta=' + document.getElementById('venta').value + '&total=' + document.getElementById('total').value;
     window.location.href=url;

    }
    </script>
    </head>
    <body>
<a href="#" onclick="javascript:reloadUrl();">LINK</a>
    </body>
    </html>

Upvotes: 1

Vanitas
Vanitas

Reputation: 903

Use location.reload(); to reload the page.

Upvotes: 1

Related Questions