Ahah, too much stale eggnog.
var option = {
error: function(request, status, error) {
alert(error);
},
success: function(data, status) {
var xml = $(data);
alert(xml.find('City').text());
},
dataType: "xml",
type: "GET",
url: "your url here"
};
$.ajax(option);
This code works for me.
On Jan 7, 2:50 pm, Steven Yang <[email protected]> wrote:
> just making sure
>
> you are not able to parse the xml at all right?
> i believe for IE you have to make sure you server returns the correct
> content type like text/xml to client inorder for you to parse
>
> hope this help
>
> On Thu, Jan 7, 2010 at 9:30 AM, Jules <[email protected]> wrote:
> > For some reason, it works on firefox (3.5.6) and doesn't work in ie
> > 6.0 and 8.0
>
> > On Jan 7, 6:39 am, Frank Peterson <[email protected]> wrote:
> > > I'm grabbing an XML file with jQuery like this:
>
> > > $(document).ready(function(){
> > > $.ajax({
> > > type: "GET",
> > > url: "http://ipinfodb.com/ip_query.php?ip=74.125.45.100",
> > > dataType: "xml",
> > > success: function(xml) {
> > > //$(xml).find().each(function(){
> > > var city = $(xml).find("City").text();
> > > /*
> > > $('<div class="items" id="link_'+id+'"></div>').html
> > > ('<a href="'+url+'">'+title+'</a>').appendTo('#page-wrap');
> > > $(this).find('desc').each(function(){
> > > var brief = $(this).find('brief').text();
> > > var long = $(this).find('long').text();
> > > $('<div class="brief"></div>').html(brief).appendTo
> > > ('#link_'+id);
> > > $('<div class="long"></div>').html(long).appendTo
> > > ('#link_'+id);
> > > });
> > > */
> > > alert(city)
> > > //});
> > > }
> > > });
>
> > > });
>
> > > The XML file looks like this
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <Response>
> > > <Ip>74.125.45.100</Ip>
> > > <Status>OK</Status>
> > > <CountryCode>US</CountryCode>
> > > <CountryName>United States</CountryName>
> > > <RegionCode>06</RegionCode>
> > > <RegionName>California</RegionName>
> > > <City>Mountain View</City>
> > > <ZipPostalCode>94043</ZipPostalCode>
> > > <Latitude>37.4192</Latitude>
> > > <Longitude>-122.057</Longitude>
> > > <Timezone>-8</Timezone>
> > > <Gmtoffset>-8</Gmtoffset>
> > > <Dstoffset>-7</Dstoffset>
> > > </Response>
>
> > > But I can't get it to pull the data out.