On Jun 23, 5:29 am, 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);
getElementsByTagName returns a collection that doesn't have a
childNodes property. You want to do something like:
...getElementsByTagName('Slideshow')[0].childNodes...
I have found it best to use getElementsByTagNameNS('*','Slideshow')
--
Rob
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---