user user - 1 year ago 65
Javascript Question

How to pass hidden ID value to another page using onclick

I would like to know how do I pass the hidden value to another page using onclick
here is my code:

<button type="button" id="requestthis" class="btn btn-primary" onclick="pass()"><a href="submitrequest.php">Request</a></button>
<input type="hidden" id="hidden_user_id">

I used this function but it didn't seem to work.

<script type="text/javascript">
function pass(id)
url: 'submitrequest.php'+id;

Other sites I visited didn't do any help.

Anyone who could point out where did I do wrong?
Thanks in advance.

Answer Source

You don't need to pass anything to pass

function pass()
        var hiddenVal = $("#hidden_user_id").val();
        url= 'submitrequest.php?hidden_vale='+hiddenVal;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download