I am trying to retrieve data from an XML using this code.
- $.ajax({
- type: "GET",
- url: "http://beermapping.com/webservice/loccity/bb6c5a3fc5baea379be645636e8e6324/Barcelona",
- dataType: ($.browser.msie) ? "xml" : "text/xml",
- success: parseXml,
- error: err
- });
- });
-
- function err(xhr, reason, ex)
- {
- alert(reason);
- }
- function parseXml(xml)
- {
- $('location',xml).each(function(i)
- {
- var $item = $(this);
- var id = item.find('id').text();
- alert(id);
-
- });
After the AJAX request it always displays the error alert as: "null".
I have taken a look to the xml code and the header is ok:
<?xml version='1.0' encoding='utf-8' ?>
<bmp_locations>
<location>
<id>6716</id>
<name>Limbo</name>
<status>Beer Bar</status>
...
UPDATE:
I have fixed the problem,
I have applied the cross-domain request, I take as instance this little
tutorialspecially thanks to
tentonaxe.
Greetings,
Edu