1

I have this XML returned from partial view.

<ActualizarItem>
   <NombreItem>GASEOSA 8.5 ONZAS</NombreItem>
   <OpcionesItem>&lt;div id="MenuItemEnPedido"data-role="navbar" data-iconpos="bottom" data-           theme="c"&gt;&lt;ul&gt;&lt;li&gt;&lt;a data-ajax="false" data-role="button"href="/Documentos/Docs/CondicionesMostrar?NumIdTransaccion=15199&amp;amp;NumIdConcepto=421"&gt;Condiciones&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a data-ajax="false" data-role="button" data-theme="a" href="/Documentos/Docs/DocsDetalle?StrIdDocumento=01500___00000000000000033" id="MostrarDetallePedido"&gt;Detalle&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a data-role="button" data-transition="sildedown" href="/Documentos/Docs/DocsEliminarItem?NumIdtransaccion=15199"&gt;Eliminar&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</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.

0

1 Answer 1

1

The NombreItem tag is not an attribute, it's a child element.

$(data).find('NombreItem').each(function () {
    alert($(this).text());
})
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry if don´t understand, but how can i get child element using jquery ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.