Slavisa Kostic
Slavisa Kostic

Reputation: 1

Click on HTML button URL string?

First off all total n00b here. Is it possible to skip clicking on HTML button with simple URL string?

example: Im visiting page www.somesite.com/page1 on page1 there is a html button (type=submit, value=ADD) when I press that button it sending me to www.somesite.com/page2

question: Is there a way to put pressing button command in URL that gonna bring me directly to page 2 (something like www.somesite.com/page1&press button value=ADD) ???

Thanks

Upvotes: 0

Views: 88

Answers (1)

Dannick Bedard
Dannick Bedard

Reputation: 402

Try with jquery

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js"></script>
</head>

<body>

    <form>
        <input id="data" value="132">
        <button class="goToPage">Save</button>
    </form>

    <script>
        $(document).ready(function () {
            $('.goToPage').click(function () {
                var data = $('#data').val();
                window.location = "yourUrl?data=" + data;
            });
        });
    </script>
    <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->

    <script src="" async defer></script>

</body>

</html>

Upvotes: 1

Related Questions