I have page which handle dynamically some data. I want to redirect to that page from some static pages using form with value of test field - I need to send parameters with #. How can I do it?
<form class="search-form" method="get" action="#?">
<input type="text" name="test" />
</form>
This solution ofc doesn't work.
I want for example write "1" in my form and then I should be redirected to mypage.com#?test=1.
Is there any function which parse form to generate url so I could just redirect? Or to just get value from submitting button link without actually redirecting?
Try this:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form class="search-form" method="get" action="">
<input type="text" id="testbox" name="test" />
<input type="button" id="button" onclick="hello()" value="send">
</form>
<script type="text/javascript">
function hello(){
var current_url = location.protocol + '//' + location.host + location.pathname + "#";
location.replace(current_url + "?test=" + document.getElementById('testbox').value);
}
</script>
</body>
</html>
Hope this is what you meant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With