Someone answered in my past question and provided me with the code necessary to pull a datetime from a server. All is well it's just that I don't know how to execute it! for example, I want to the action to happen on pageload, how can I do that?
here's the Ajax/JSONP code I was given:
$.ajax({
url: 'http://timeapi.org/utc/now.json',
dataType: 'jsonp'
})
.done(function(response) {
// response = {"dateString":"2012-03-06T02:18:25+00:00"}
console.log(response.dateString);// "2012-03-06T02:18:25+00:00"
});
P.S. does the "$" refer to JQuery? I am not very familiar with this syntax...the $.ajax and the .done?
$.getJSON- api.jquery.com/jQuery.getJSON - but i'm pretty sure the type should be just'json'p.s. yes, $ refer to the jQuery "object"