Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-27
1
Medium Priority
?
199 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

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

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

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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…

618 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