I found the solution. The solution is in http://groups.google.com.ec/group/prototype-scriptaculous/browse_thread/thread/37271ffc295fefbf/b8d47bc1f5cf8c66?lnk=gst&q=xml#b8d47bc1f5cf8c66 in the first paragraph :D The problem was in the way to accede to XML file, the code syntax was bad. You must put attention with getElementsByTagName and childs.
On 22 jun, 14:29, dy3g0s <[email protected]> wrote: > Hi, > I actually work with Slideshare API, php and prototype. I make a cURL > call in php to consume a certain Slideshare API method, the php script > return an xml result with the header <header('Content-type: text/ > xml');> I obtain a xml response, the current API does not returns json > or other format. > > My ajax code is: > new Ajax.Request('slideshare.php', > { method: 'get', encoding: 'UTF-8', > parameters: { > query: myQuery, > type: functionType > }, > onComplete: function(request){ > var response = request.responseXML; > widget.setEstadosService(response); > var slidesLength = > response.getElementsByTagName > ("Slideshow").length; > if (slidesLength == 0){ > > $('estadoSlideshare_'+id).update('It is not exist results'); > }else{ > > widget.setLimiteXmlOrJson(slidesLength); > loadSlides(id); > } > } > .... > .... > > } > > In the end, the problem is not the response, neither php script or > structure of ajax call. The problem is when I try to work and accede > to XML file, I received the response with <request.responseXML> and > when I try e.g.: > > var response = request.responseXML; > //this no work :( > alert(response.getElementsByTagName('Slideshow').childNodes > [0].nodeValue); > //this work > alert(response.getElementsByTagName("Slideshow").length); > > I do not understand what happen. I tried changing "nodeValue" with > "data" or "text", but nothing. Also, I tried to parse XML response > with: > > function loadXML(xmlFile){ > var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); > > xmlDoc.async="false"; > xmlDoc.onreadystatechange=function verify(){ > if (xmlDoc.readyState != 4){ > return false; > } > }; > xmlDoc.load(xmlFile); > var ticker=xmlDoc.documentElement; > return ticker; > > } > > etc., etc., and other ways, but nothing function. > > Can you help me giving any links or tutoriales to work with XML files > with prototype. I thank for your help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
