not tried this, I might have an obvious error, but this is what i would try

               var $suggest =$("#suggest");
               var $testo = $("#testo");

// perform function on each isbn from xml source
$("isbn", xml).each(function (i, n)  {
                   // append the text to the suggestion
                  $suggest.append($(i).text());
})



2008/7/11 neosz <[EMAIL PROTECTED]>:

>
> Hi folks,
>
> I'm a jQuery newbie and I'm trying to traverse a XML given by a PHP
> script to get information for organizing them and displaying them on
> my page. Here's a kind of my XML:
>
> <?xml version="1.0" ?><book><isbn>0156001314</isbn><isbn>015603297X</
> isbn><isbn>0847829863</isbn><isbn>0847826465</isbn><isbn>0151013519</
> isbn><isbn>0156029065</isbn><isbn>015601159X</isbn><isbn>0810959054</
> isbn><isbn>0156032392</isbn><isbn>3829601867</isbn></book>
>
> and here's my code:
>
>        $("document").ready(function(){
>                var suggest = "#suggest";
>                var testo = "#testo";
>                var offSet = $(testo).offset();
>
>                $("body").append("<div id=\"suggest\"></div>");
>                $(suggest).css({
>                        position: "absolute",
>                        top: offSet.top - 1 + $(testo).outerHeight() + "px",
>                        left: offSet.left + "px",
>                        width: $(testo).outerWidth() - 2 + "px",
>                        border: "1px solid #666666"
>                });
>
>                $(suggest).hide();
>
>                $("#testo").bind("keyup", function(e){
>                        if (e.keyCode == 13) {
>                                $(suggest).html("Loading...").show();
>                                $.ajax({
>                                        type: "GET",
>                                        dataType: "XML",
>                                        url: "getISBN.php",
>                                        data: "testo=" + $("#testo").val(),
>                                        success: function(xml){
>                                                //var isbn = $("isbn",
> xml).text();
>                                                $(suggest).empty();
>
>                                                $(suggest).append(isbn);
>                                        }
>                                });
>                        }
>                });
>        });
>
>
> in this way the script takes all the ISBN and it doesn't display a
> list (the one I need in my situation).
> Please help!
>

Reply via email to