Insert more values into a variable

Asked

Viewed 860 times

-1

            var $e = $(e.currentTarget);
            var eData = $e.data();

            var personagem = this.model.get('personagens').get({'id': eData.personagemId});

            var candidatos = personagem.get('candidatos');

I need to put one more character backbonemodel attribute within the candidate variable without changing the values that are already there, I have tried to use get again, but it overwrites the values that already exist within the variable, there is some way to insert one more value into the var candidates without changing the values that are already in it?

  • 2

    Edit your question and tell us where and/or in what format the data you get (probably by this method get) come/are and where exactly you want to add (in an array, in an hash table, in a single variable...).

1 answer

0


  • Thanks Paulo, I used the push and it worked the way I needed it.

  • good Wilson, it’s always good to be able to help!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.