Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
parsing simpleviewer xml with javascript and AJAX

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
asimpson
New one
New one


Joined: 20 May 2008
Posts: 1

PostPosted: Tue May 20, 2008 12:17 am    Post subject: parsing simpleviewer xml with javascript and AJAX Reply with quote

I'm trying to parse a simpleviewer xml file for a gallery app (ImageFlow) and have hit a problem beyond my knowledge. The AJAX is done via prototype, the code is below. If you want to see the xml try http://staumc.co.uk/ImageFlow/feed1.php?aid=43, and for a demo site running the code try http://staumc.co.uk/ImageFlow/test2.html. I think the problem may be with the request but I really don't know enough
Thanks for any help
Andy
Code:
<script src="javascripts/prototype.js"></script>
<script src="javascripts/effects.js"></script>
<script src="javascripts/imageflow.js"></script>

<script>
// application
var MyApp = function () {
   var imgTemplate = new Template('<img src="reflect.php?img=#{filename}" longdesc="#{filename}" alt="#{caption}" />');

    return {
        loadAlbum : function (aid) {
            $('startButton').hide();
            $('photoAlbum').show();
            var myAjax = new Ajax.Request('feed1.php?aid=' + aid, {
                  method: 'get',
                  onSuccess: initializeAlbum
                  });
        }
    };
    function initializeAlbum(response) {
    var galleryXML;
    var imgHTML = '';

    try {
        galleryXML = response.xml;
    } catch (e) {
        console.error(e, "\n", response.responseText);
    }

    alert (response)
    alert ('response.xml=' + response.xml)
    var thumbnailPath = getAttributeValue(galleryXML, 'simpleviewerGallery', 'thumbPath');
    var imagePath = getAttributeValue(galleryXML, 'simpleviewerGallery', 'imagePath');
    var title = getAttributeValue(galleryXML, 'simpleviewerGallery', 'title');
    var images = galleryXML.getElementsByTagName('image');
    for(var i=0; i <images.length; i++) {
   var caption = getNodeValue(images[i], 'caption');
   if (caption == null){
      caption="&nbsp;"
   }
   var filename = getNodeValue(images[i], 'filename');
   imgHTML += imgTemplate.evaluate({filename : imagePath+filename, caption : caption})
    }

    $('images').innerHTML = imgHTML;
    // IE bug : IE needs a moment to let the innerHTML change register before proceeding
    // so we add a small timeout to let it catch its breath
    setTimeout(ImageFlow.initialize, 10);
}

}();

</script>

________
Teen Videos
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert