?
Solved

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

Posted on 2011-09-27
1
Medium Priority
?
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

777 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