2
I’m trying to pass on the value of one input text for an array of objects, via jQuery but not understood how to insert it in array. I tried to wear something like:
var usuario = $('#username').val();
And then add in place of carlos but it didn’t work out.
Nome:<input type="text" id="username">
Senha:<input type="password" id="password">
var userstocreate = [{
username: 'carlos',
password : 'Carlos123@'
}];
In short, I needed to create a JSON based on the values of inputs, the person fills the fields and is generated a array of objects within the variable userstocreate
.
You can post the full HTML of the form and the full script as well?
– Luis Henrique