Reputation: 5524
I have this XML returned from partial view.
<ActualizarItem>
<NombreItem>GASEOSA 8.5 ONZAS</NombreItem>
<OpcionesItem><div id="MenuItemEnPedido"data-role="navbar" data-iconpos="bottom" data- theme="c"><ul><li><a data-ajax="false" data-role="button"href="/Documentos/Docs/CondicionesMostrar?NumIdTransaccion=15199&amp;NumIdConcepto=421">Condiciones</a></li><li><a data-ajax="false" data-role="button" data-theme="a" href="/Documentos/Docs/DocsDetalle?StrIdDocumento=01500___00000000000000033" id="MostrarDetallePedido">Detalle</a></li><li><a data-role="button" data-transition="sildedown" href="/Documentos/Docs/DocsEliminarItem?NumIdtransaccion=15199">Eliminar</a></li></ul></div></OpcionesItem>
</ActualizarItem>
I' want to retrieve NombreItem from that XML using jquery
function agregarItemAPedido(tcLink) {
// Se agrega el item al documento
$.post(tcLink,
function (data) {
var $this = $(data);
$(data).find('ActualizarItem').each(function () {
alert($(this).attr('NombreItem'));
})
}
);
}
But it never show the alert message. I'm was reading some posts, but none of them help me.
Upvotes: 1
Views: 290
Reputation: 268344
The NombreItem
tag is not an attribute, it's a child element.
$(data).find('NombreItem').each(function () {
alert($(this).text());
})
Upvotes: 1