$.getJSON is meant to get JSON objects, which are, at their heart,
script elements that get run (hence the callback). Because they are
script elements they can be loaded in from another domain.

Unfortunately you can't use the usual $.load or $.ajax functions to
load in yjr XML because they use the XMLHttpRequest system, which
can't load things in from other domains.

You're going to have to use some sort of "server side proxy" because
the web service only provides XML results.

First link from a Google search of "ajax xmlhttprequest proxy":

  
http://www.xml.com/pub/a/2005/11/09/fixing-ajax-xmlhttprequest-considered-harmful.html

It's old but should point you in the right direction.

Karl Rudd

On Thu, Sep 11, 2008 at 6:24 AM, standerby <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am trying to call a cross domain web service using the following
> code. The return data is in XML format. It appears that the call back
> function isn't get called. I can not add ?callback=? to the then of
> the url. Any thought? Thanks.
>
>  $.getJSON("http://www.webservicex.net/WeatherForecast.asmx/
> GetWeatherByZipCode",
>   {zipcode:"21234"},
>   function(data){
>    var idx = 0;
>    $(data).find('WeatherData').each(function(){
>      WeatherData[idx] = $(this).find('MaxTemperatureF').text();
>      WeatherPicture[idx] = $(this).find('WeatherImage').text();
>      idx++;
>    }); //close each(
>  });
>

Reply via email to