Search code examples
javascriptwidgetmobile-phonesw3c

AJAX requests in mobile widgets


I've added the code for an AJAX call in my mobile widget but I don't get a response. Any ideas?

$.ajax({
    type: "GET",
    url: "http://www.tfl.gov.uk/tfl/syndication/feeds/disruptions-tube-offset-now.xml",
    dataType: "xml",
    success: function(xml) {}
});

Solution

  • You have to make sure your config.xml contains the security tag and network="public" attribute inside widget tag:

    <security>
      <access>
        <host>tfl.gov.uk</host>
      </access>
    </security>