Vote count:
0
I have this ajax function that receive a json var.
$.ajax({
type: "POST",
url: "@Url.Action("FilterCheck","Operatore")",
datatype: "json",
traditional: true,
data: { 'mycheck': mycheck, 'idprot': idprot, 'id': '@Model.id' },
success: function (response) {
$('#external-events').empty(); // clear existing items
$.each(response, function (index, item) {
var div = $('<div class="col-lg-3"><div class="external-event"></div></div>'); // Create new element
div.text(item.id + ' ' + item.nome + ' ' + item.cognome); // Set inner text
$('#external-events').append(div); // add the new element
},
I would refresh this HTML div:
<div id='external-events'>
@foreach (HAnnoZero.Repositories.utente item in ViewBag.Utenti)
{
<div class='col-lg-3'><div class='external-event'>@item.id- @item.cognome @item.nome</div></div>
}
With the jquery function "each" i do the loop for more element json. In this way don't work, write only the first and not the second. How I can do? Thank you
asked 38 secs ago
ajax refresh div with json loop
Aucun commentaire:
Enregistrer un commentaire