Solved

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

Posted on 2011-09-27
1
181 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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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 get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now