Hi
I have a function
var url = "MyAvailability.aspx?mode=get";
$.get(url,
function(data) {
alert(data);
});
that returns a Json string representation
events: [{'id': 1,'start': new Date(year, month, day, 12),'end': new Date(year, month, day, 13, 30),'title': 'Lunch with Mike'},{'id': 2,'start': new Date(year, month, day, 14),'end': new Date(year, month, day, 14, 45),'title': 'Dev Meeting'},{'id': 3,'start': new Date(year, month, day + 1, 17),'end': new Date(year, month, day + 1, 17, 45),'title': 'Hair cut'},{'id': 4,'start': new Date(year, month, day - 1, 8),'end': new Date(year, month, day - 1, 9, 30),'title': 'Team breakfast'},{'id': 5,'start': new Date(year, month, day + 1, 14),'end': new Date(year, month, day + 1, 15),'title': 'Product showcase'},{'id': 6,'start': new Date(year, month, day, 10),'end': new Date(year, month, day, 11),'title': 'I'm read-only',readOnly: true'}]';
If i do alert(data);
it works but if i am trying to assign the data to a variable it fails.
my aim is to return from the function something like
return {
events: [
{
"id": 1,
"start": new Date(year, month, day, 12),
"end": new Date(year, month, day, 13, 30),
"title": "Lunch with Mike"
},
{
"id": 2,
"start": new Date(year, month, day, 14),
"end": new Date(year, month, day, 14, 45),
"title": "Dev Meeting"
},
{
"id": 3,
"start": new Date(year, month, day + 1, 17),
"end": new Date(year, month, day + 1, 17, 45),
"title": "Hair cut"
},
{
"id": 4,
"start": new Date(year, month, day - 1, 8),
"end": new Date(year, month, day - 1, 9, 30),
"title": "Team breakfast"
},
{
"id": 5,
"start": new Date(year, month, day + 1, 14),
"end": new Date(year, month, day + 1, 15),
"title": "Product showcase"
},
{
"id": 6,
"start": new Date(year, month, day, 10),
"end": new Date(year, month, day, 11),
"title": "I'm read-only",
readOnly: true
}
]
};
but i am not able to
if i do return data doesn t work
could you help me please i am getting crazy on this