I have this simple html page:
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$(document).on('click', 'button', function(){
var selectval = $('select').val();
$.get('/',
{
selectval: selectval
});
});
});
</script>
</head>
<body>
<select>
<option value="Option1">Option1</option>
<option value="Option2">Option2</option>
</select>
<button>Submit</button>
</body>
</html>
I want the button to act like a submit button on a form with get method. So clicking the button should submit the get variable (selectval) as a query string.
So clicking the button should go to:
http://domain.com/?selectval=option1
Is there a way to do this without wrapping into a form?
form?