开发者

parsing simple xml with jquery

开发者 https://www.devze.com 2023-01-07 06:18 出处:网络
i\'ve got a simple xml file (called by ajax) that contains only: <result>1</result>开发者_开发问答

i've got a simple xml file (called by ajax) that contains only:

<result>1</result>开发者_开发问答

with jquery, i can get the value (1) of result?

thanks! Rob


$.ajax({
    url: '/foo.xml',
    success: function(xml) {
        alert($(xml).find('result').text());
    }
});


jQuery.get('myxml.xml', function(xml){
    var result = jQuery(xml).text();
    alert(result);
});
0

精彩评论

暂无评论...
验证码 换一张
取 消