Well the xml file is not on my server, but I'll try to shoot them an email and let them know, they should set the headers.
On Jan 7, 4:44 pm, Jules <jwira...@gmail.com> wrote: > As suggested by Steven, set the ContentType to "text/xml". I don't > know how to do it in php, but here is the snipped from data source in > c# . > > StringBuilder sb = new StringBuilder(); > sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); > sb.Append("<Response>"); > sb.Append("<Ip>74.125.45.100</Ip>"); > sb.Append("<Status>OK</Status>"); > sb.Append("<CountryCode>US</CountryCode>"); > sb.Append("<CountryName>United States</CountryName>"); > sb.Append("<RegionCode>06</RegionCode>"); > sb.Append("<RegionName>California</RegionName>"); > sb.Append("<City>Mountain View</City>"); > sb.Append("<ZipPostalCode>94043</ZipPostalCode>"); > sb.Append("<Latitude>37.4192</Latitude>"); > sb.Append("<Longitude>-122.057</Longitude>"); > sb.Append("<Timezone>-8</Timezone>"); > sb.Append("<Gmtoffset>-8</Gmtoffset>"); > sb.Append("<Dstoffset>-7</Dstoffset>"); > sb.Append("</Response>"); > > Response.Clear(); > Response.ContentType = "text/xml"; > Response.Write(sb.ToString()); > Response.End(); > > On Jan 8, 2:42 am, Frank Peterson <fictionalper...@gmail.com> wrote: > > > That works in IE8, but in FF 3.5.3 I get undefined in the alertbox. > > I've disabled adblock and flashblock, so its not those interfering. I > > dont get anything in the error console either. > > > The code I had posted earlier doesn't work in FF 3.53 either. I'm > > accessing it by running it on my desktop with this as the URL > > file:///c:/xampplite/htdocs/DEVELOPMENT/geolocate.htm > > but even when I access it via a decent URL I still get undefined in > > FFhttp://localhost/DEVELOPMENT/geolocate.htm > > > On Jan 6, 10:13 pm, Jules <jwira...@gmail.com> wrote: > > > > 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 <kenshin...@gmail.com> 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 <jwira...@gmail.com> 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 <fictionalper...@gmail.com> 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.