I need to submit a form by clicking a button outside the form. Here is the simple page:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>title</title>
    <script type="text/javascript">
        $(function () {
            $("#buy-button").on("click", function () {
                $("#refresh-form").submit(function () {
                    alert('test');
                });
            });
        });
    </script>
</head>
<body>
<header>
    header
</header>
<div id="main-div">
</div>
</div>
<div id="navigation-div">
    <form id="refresh-form" action="test.php">
        <button id="map-button">Refresh</button>
    </form>
    <button id="buy-button">Buy</button>
</div>
<footer>
    footer
</footer>
</body>
</html>
When I click the buy-button it won't refresh the page. What am I missing?
Suppose that I have a list of buttons inside a form, which of them has button as type, if I can successfully submit the form will I get all the values set for each button anyway or will I get only the values of the button which type has been set as submit?
 
     
     
     
    