php - how to pass multiple text box values in javascript variable? -


<input type="hidden" name="email" value="website_list">  <input type="hidden" name="name" value="john.doe@foo.com">  <input type="hidden" name="fname" value="john">

<script type="text/javascript">   var subscriber_details = {  email : 'john.doe@foo.com',  name  : 'website_list',  fname : 'john'  }    </script>

i want pass hidden value in javascript variable in same manner "subscriber_details" .

so should do?

<script type="text/javascript">  var subscriber_details = {    email : "'"+ document.getelementsbyname("email").value +"'",    name  : "'"+ document.getelementsbyname("name").value +"'",    fname : "'"+ document.getelementsbyname("fname").value +"'" }  </script> 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -