How can I use the server date instead of javascript date for displaying calender?

91 views
Skip to first unread message

Manpreet Arora

unread,
Feb 12, 2013, 1:36:10 AM2/12/13
to jquery-wee...@googlegroups.com
I modified the javascript code to generate ajax request nad get the date from the server as:
 

return

{

options: {

date: getDate(),

......................................

 

function

getDate()

{

$.ajax({

type:

"GET",

async:

false,

url:

"/sandstorm/getServerTimeForCalender",

dataType:

"json",

success:

function(data) {

alert(data);

},

});

}

 

However the javascript code halts on following line

_dateFirstDayOfWeek: function(date) {
var self = this;
var midnightCurrentDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
var adjustedDate = new Date(midnightCurrentDate);
adjustedDate.setDate(adjustedDate.getDate() - self._getAdjustedDayIndex(midnightCurrentDate));
return adjustedDate;
},

 

 

Please help

Manpreet Arora

unread,
Feb 12, 2013, 1:41:44 AM2/12/13
to jquery-wee...@googlegroups.com
TypeError: date is undefined

I ger the error: date is undefined 

Please help

 

Manpreet Arora

unread,
Feb 12, 2013, 4:25:19 AM2/12/13
to jquery-wee...@googlegroups.com
Problem solved. From the spring controleer I returned the Date object and not the StringDate. It worked!
Reply all
Reply to author
Forward
0 new messages