SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast gazman99's Avatar
    Join Date
    May 2007
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery | Load cached xml file

    Hi all,

    I have html/jquery based web app that loads data from an xml file upon document ready.
    I also have a manifest.appacache that should cache the xml file. When i try running the app offline the xml will not load.

    Where am I going wrong? This code is taken from inside an object (hence the methods & private_methods)

    Code:
    loadXML : function( ) { 
         var XML_url = "details.xml";
         var isOnline = navigator.onLine;			
         if(isOnline)XML_url+="?"+Math.random();
    
         $.ajax({
              type: "GET",
              url: XML_url,
              dataType: "xml",
              success: private_methods.parseXml
         });	 
    }
    methods.loadXML.apply()

  2. #2
    SitePoint Addict
    Join Date
    Apr 2011
    Posts
    265
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Maybe the problem is not from JS code, but from browser that not caches the xml file.
    Not know the solution, but look on the net for "browser cache xml file".
    Free: Web Programming Courses HTML, CSS, Flash
    Web Programming: AJAX Course and PHP-MySQL Course video Lessons
    Good JavaScript and jQuery course for beginners


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •