0 votes
in PHP by
How to Run a PHP code after button click but without refreshing page?

1 Answer

0 votes
by

You need to use either the onsubmit event of the form or the onclick event of the button.

In the event handler, you assemble a URL and "get" it. For example:

<script type="text/JavaScript">

function submitCouponCode()
{
    var textbox = document.getElementById("couponCode");
    var url =
        "https://www.example.com/script.php?couponCode=" + encodeURIComponent(textbox<span style="border:0px; box-sizing:inherit; color:var(--black-750); font-family:inherit; font-stretch:inherit; font-style:inherit; font-variant:inherit; font-weight:inherit; line-height:inherit; margin:0px; padding:0px; vertical-align:b

Related questions

0 votes
asked Jun 23, 2019 in PHP by SakshiSharma
0 votes
asked Jun 23, 2019 in PHP by SakshiSharma
...