How to load an xml response in javascript/jquery?

How to load an xml response in javascript/jquery?

Hello all,

I want to display current weather on a html page using world weather online API. So i need to parse the xml document which i get with the following url:

http://www.worldweatheronline.com/feed/weather.ashx?lat=48.40&lon=10.00&format=xml&num_of_days=2&key=[my_key]

If I enter this url in the browser i can see the xml document. Now i want to load this document into an object in my javascript code but it doesn't work.

I tried following jquery code:

  1. var xmldoc = $.ajax({
                    type: "GET",
                    url: "http://www.worldweatheronline.com/feed/weather.ashx?lat=48.40&lon=10.00&format=xml&num_of_days=2&key=[my_key]",
                    dataType: "xml"
                }).responseText;
    alert("Data: " + xmldoc);




Unfortunately, xmldoc is empty :( Can somebody help me with my problem? Thanks a lot in advance!

Cheers, Sveti