Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
How to properly pass variables in an array from a form using Javascript jquery

when I run the code below it works fine

<script>

var key_values =[79, 129, 183, 128, 66];
const secret_keys = new Uint8Array(key_values);
console.log(secret_keys);

//Uint8Array(64) [ 79, 129, 183, 128, 66 ]

</script>

Here is my issue:

when I pass the key_values variable into an arrays from form inputs. it does not display any value in the console.

This is what it displayed in the console Uint8Array [0] instead of Uint8Array(64) [ 79, 129, 183, 128, 66 ]

here is the code.

<script>
            $(function () {
                $('#save').click(function () {
                    
// inputted form values 79, 129, 183, 128, 66

var key_values = $('#my_keys').val();

const secret_keys = new Uint8Array([key_values]);
console.log(secret_keys);

//Uint8Array [0]



    });
            });
</script>
<input type="text" id="my_keys" value="79, 129, 183, 128, 66">

                    <input type="button" id="save" value="save" />
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to parse the string as an array before passing it to the constructor or just split by comma to get an array.

const secret_keys = new Uint8Array(key_values.split(","));
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!