Assistance with adding JQuery getJSON needed

error77 used Ask the Experts™
Hi all,

I wonder if anyone could help me here.

I have this code:

if ( ( today === highlightDay || today === presetDay || today === 21 || today === 30 ) ) { thisTheme = o.pickPageHighButtonTheme; }
Now, where you see the "today" link today === 21 || today === 30 etc....

these are hardcoded.

What I need to do is to be able to read the 21 , 30 etc from a JSON file instead.

I've been looking here:  but I don't know how to get this together.

Can anyone help please?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

//Try something like this:

var minute = 0;
var second = 0;
$.getJSON( "", retrieveData );

function retrieveData( response ) {
  minute = response.minute;
  second = response.second;
  alert( "Minutes: " + minute + "\rSeconds: " + second );


I'm a bit confused sorry...

I need to read multiple today's from a json file and add then like today === 21 || today === 30 etc  ...when the date of the current month.

I'm basically trying to add dynamic dates to a calendar.

Could you explain a bit please? No sure what to do to change your code to my purpose...


I've created a json file with the same data as your sample one and uploaded it to my domain, then changed the url to point to mine.

The alert doesn't work on mine.

Do I need any special settings for it to work on my server?

Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


Hello ?
Top Expert 2014
Why a json file?

for example you have dates.txt : 21;30

Array.prototype.contains = function(element)  {
   for(var i=0;i<this.length;i++) if(this[i] == element) return true;
   return false;

var dates = [];

$(document).ready(function() {

$.get("dates.txt", function(data) {
     dates = data.split(";");


Open in new window

At this time you can use :

if ( today === highlightDay || today === presetDay || dates.contains(today) ) { thisTheme = o.pickPageHighButtonTheme; }

Open in new window


Your'e a genius! Thanks a billion for your help!
Top Expert 2014

You're welcome! Thanks for the points and a good week to you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial