Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass hidden field value using Jquery

I have a normal hidden Input field where I am generating random string. I need that to be appended to the URL where I am trying to post data to another page.

I have done this and works pretty well.

url:'Upload.html?field1=newvalue',

This is my hidden input field

<input type="hidden" id="randomdirectory"/>

Now instead of newvalue in the query string I need to pass my random directory value.

like image 477
coder Avatar asked Dec 20 '25 05:12

coder


2 Answers

easily accomplished just do the following

var value = $("#randomdirectory").val();
url:'Upload.html?field1='+value ,

thats it ..

like image 114
rainykeys Avatar answered Dec 22 '25 19:12

rainykeys


Just give a name to the hidden field.

<input name="field1" type="hidden" id="randomdirectory" value="randomvalue"/>
like image 44
xdazz Avatar answered Dec 22 '25 19:12

xdazz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!