the first try will not work with latest jquery, as xpath is now into a
seperate plugin. So stick to your second try. Also, make sure you search
your xml when the xml is actually loaded, so in the ajax function callback

$.ajax({//your params here}, function(xml,status){
if(status=='success'){
$('building', xml).each(function()
       {
               alert($("city_id", this).text(););
       });
}
});

cheers,

alex

On Jan 29, 2008 7:29 AM, David Serduke <[EMAIL PROTECTED]> wrote:

>
> Actually if it doesn't have to be part of the DOM assuming you are
> passing in a context as the second parameter of $() which the original
> author is.
>
> I don't use the xpath plugin so I'm not sure about that but the second
> attempt you said failed worked for me.  I got 3 alert boxes with '1',
> '2', '3' just as I expected.  Here is my test case.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> TR/html4/strict.dtd">
> <html>
>  <head>
>    <title>Tester</title>
>    <style type="text/css">
>    </style>
>    <script type="text/javascript" src="jquery.js"></script>
>    <script type="text/javascript">
>      function doIt() {
>        $.get("jquery_xml_load.xml", function (xml) {
>              $("building", xml).each(function () {
>                    alert($("city_id", this).text());
>                  });
>            });
>      }
>
>      $(document).ready(function() {
>        $("button").click(doIt);
>      });
>    </script>
>  </head>
>  <body>
>    <button>Do It</button>
>  </body>
> </html>
>
> The xml file is a copy and paste of what you put in your post.  I
> think your problem is somewhere other than what you posted.
>
> Hope that helps.
>
> David
>



-- 
Alexandre Plennevaux
LAb[au]

http://www.lab-au.com

Reply via email to