Solved

jQuery code for reading date from file - only working in Safari

Posted on 2011-09-27
1
188 Views
Last Modified: 2012-05-12
Hi,

I am working on a web page that displays a date that is read in from a text file.

Found this simple piece of jQuery code which is working in Safari only:

      <script language=javascript type='text/javascript'>
          //process date file
          jQuery.get('date.txt', function(data) {
          $('#refreshdate').html(data);
          });
        </script>

        <a id="refreshdatelabel" title="RefreshDateLabel" >Reports last refresh date: </a>
        <a id="refreshdate" title="RefreshedDate" >Sept 15, 2011</a>

Safari displays the file's Sept 19, 2011 date.

IE & Chrome both display the defaulted anchor date (Sept 15, 2011) & Firefox doesn't display anything at all for refreshdate (does display refreshdatelabel).

Suggestions are welcomed!
0
Comment
Question by:ssebring
1 Comment
 

Accepted Solution

by:
ssebring earned 0 total points
ID: 36713772
have it now working on all browsers with (in addition to testing on web server instead of local) :

      <script language=javascript type='text/javascript'>
          function contentDisp()
          {
            $.ajax({
               url : "date.txt",
               success : function (data) {
                 $("#refreshdate").html(data);
               }
             });
          }
        </script>
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use NFS (Network File System) in Asp.net mvc 5? 4 43
html border input line 7 13
Designing forms 3 16
what is the best Integrated development environment 2 19
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question