Avatar of error77
error77

asked on 

Assistance with adding JQuery getJSON needed

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: http://api.jquery.com/jQuery.getJSON/  but I don't know how to get this together.

Can anyone help please?

Thanks
JavaScriptAJAX

Avatar of undefined
Last Comment
leakim971
Avatar of Proculopsis
Proculopsis


//Try something like this:

var minute = 0;
var second = 0;
$.getJSON( "http://json-time.appspot.com/time.json?tz=GMT&callback=?", retrieveData );

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

Avatar of error77
error77

ASKER

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...
Avatar of error77
error77

ASKER

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?

Avatar of error77
error77

ASKER

Hello ?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of error77
error77

ASKER

Your'e a genius! Thanks a billion for your help!
Avatar of leakim971
leakim971
Flag of Guadeloupe image

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

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo