-1
in my application when the user clicks to include performing two queries and each returns (id and name), I set up a mustache template, and would like to load this data in two dropdownlist. the question is how to load this data.
$(document).on('click', '#btn_incluir', function () {
var btn = $(this);
if ("#txt_horaI" == "HH:MM") {
message: "Campo Hora Incial não pode ser vazio";
}
else if ("#txt_horaF" == "HH:MM") {
message: "Campo Hora Final não pode ser vazio";
}
else {
var url = '@Url.Action("RecuperarA", "Operacao")',
dadosA = {
carros
};
var url = '@Url.Action("RecuperarP", "Operacao")',
dadosB = {
motorista
};
incluir_linha_produto();
}
})
function incluir_linha_produto() {
$('#grid tbody').append(Mustache.render($('#template-produto').html() ));
}
<script id="template-produto" type="x-tmpl-mustache">
<tr>
<td>
<input class="form-control form-control-sm" type="text" placeholder="De">
</td>
<td>
<input class="form-control form-control-sm" type="text" placeholder="Para">
</td>
<td>
<input class="form-control form-control-sm" type="text" placeholder="Cliente">
</td>
<td>
<select id="Motrista"><option selected="selected" value="">Motorista</option></select>
</td>
<td>
<select id="carro"><option selected="selected" value="">carro</option></select>
</td>
<td>
<input class="form-control form-control-sm" type="text" placeholder="Tempo">
</td>
<td>
<a class="btn btn-warning btn_remover" role="button">
<i class="glyphicon glyphicon-trash"></i>
</a>
</td>
</tr>
</script>
Easier to win in the mega sena than to show a superb guide.
– MAX.JAC
ai you look at several closed questions, without even giving the min of attention.Ha excuse here if you value the subjective quality very much.
– MAX.JAC
It is that it was not very clear what you need... Why nobody guides... You need to recover the data and mount a select this? Example a motorist combo that?
– Edenilson Bila
Edenilson, as I said, I can get to the controller where I can have an Actionresult or a Jsonresult(I’m trying both ways because I’m studying) what I don’t know how to do is load the data into a mustache dropdownlist. here
– MAX.JAC
<select id="Motrista"><option Selected="Selected" value="">Driver</option></select> as I load the data from here for example public Jsonresult Recuperarnn(string DT, string HI, string HF) { var Listaa = Operacaomodel.Recuperarlistamotoristan(DT, HI, HF); Return Json(Listaa ); }
– MAX.JAC
I’ll put as I do here, it may be useful, but I don’t use Actionresult Json usage
– Edenilson Bila
Mustache would be a Bootstrap-like framework?
– Edenilson Bila
yes.. I was testing the two ways both by Actionresult and by Json.
– MAX.JAC