It's the first time I'm dealing with this situation, so I do not know exactly how to get around it. The fact is this, I have a form with several inputs, divided by sections:
IntheExperienceTab,IfillinsomeinputswiththedataandwhenIclickaddIcreateblockswiththefilleddataasfollows:
$('#'+destino).append("<div class='blococurso box-experiencia'>"
+"<label>Empresa:</label> <span class='content' data-content="+experiencia.empresa+">"+experiencia.empresa+"</span><br>"
+"<label>Cargo:</label> <span class='content' data-content="+experiencia.cargo+">"+experiencia.cargo+"</span><br>"
+"<label>Admissão:</label> <span class='content' data-content="+experiencia.admissao+">"+addDemissao.admissao.toString().replace(/,/g, '/')+"</span><br>"
+"<label>Demissão:</label> <span class='content' data-content="+experiencia.demissao+">"+addDemissao.demissao.toString().replace(/,/g, '/')+"</span><br>"
+"<label>Atividades:</label> <span class='content' data-content="+experiencia.atividades+">"+experiencia.atividades+"</span><br>"
+"<i class='fa fa-close btn-fechar fechar-experiencia' data-destino='' data-funcao='remover'></i></div>"
);
When I click the save data button, I get all the inputs and put in obj javascript, and data like these from the experience that are in Divs, I get like this:
$("#painel-experiencia .box-experiencia .content").each(function(index){
experiencia.push( $(this).text() );
});
At this point I have an Array similar to this;
. ["dasd", "asdas", "01/01/2017", "01/01/2017", "dasdasd", "asdasd", "asdasd", "01/01/2017", "01/01/2017", "asdasdaasd", "asdasda", "asdasd", "01/01/2017", "01/01/2017", "dsadasdas"]
But what I need is more for this:
. [{"empresa": "asdas", "admissao": "01/01/2017", "demissao": "01/01/2017", "atividades":"dasdasd"}, {"empresa": "asdas", "admissao": "01/01/2017", "demissao": "01/01/2017", "atividades":"dasdasd"}]
What I'm looking for is an associative array and a way to add each experience block as an array, inside a wrapper array. What I need is more for json, if that's the only way, how to insert the data into one Json and then wrap it in another json?
If they knew otherwise, it would be very helpful.