I am trying to pass the value of an input text to an array of objects, via jQuery but I did not understand how to insert it into array . I tried to use something like:
var usuario = $('#username').val();
And then add in place of carlos but did not work.
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 the input s, the person fills the fields and an array is generated within the userstocreate
variable.