I have a combo when event occurs onchange
it performs a query on the database with the selected value and inserts into a div
values, the problem is that when I apply $('.minhaDiv').html(resultado)
it returns me only the last given, I tried with append
and it repeats several data below those consulted previously, what I would need would be that it overlap with all the data the values previously set on the screen.
How could I do this? Any solution?
An example of my code:
$("#dados_solicitacao").on('change','#caminho', function change(){
var selected = $(this).val();
var url = urlprojeto+"/minhaUrl.php";
var data = 'referencia='+selected+'';
var data = get_contents(url, data);
var aDados = data.dados;
var cDados = aDados.length;
for( s=0; s<cDados; s++ )
{
var status = aDados[s].cad_ativo;
var referencia = aDados[s].cad_referencia;
var txt= 'ativo:'+status;
txt+= ' minha referencia:'+referencia;
$(".div_selected").html(txt);
}
});
WhatIhaveonthescreen,andIwouldlikeittoalwaysbechangedbychangingthevalueselectedinthecombo.
Becausetheyaredifferentdata,theyneedtobereplaced,becausemycomboservesasafilter,whereinthiscomboInavigatethroughmy"folders" (topics of my site).