var tdValue = $.parseJSON(getMedicationOrderInstance(freqKey, $.datepicker.formatDate('dd M yy', dateFrom), $.datepicker.formatDate('dd M yy', dateTo)));
this is my ajax call which is returning following json and I am trying to parse but throwing exception
Exception thrown and not caught json2.js (503,13)
{
"25": [
"00:00",
"05:00",
"10:00",
"15:00",
"20:00"
],
"26": [
"01:00",
"06:00",
"11:00",
"16:00",
"21:00"
],
"27": [
"02:00",
"07:00",
"12:00",
"17:00",
"22:00"
]
}
Guys please help. It's cracking my head.
function getMedicationOrderInstance(key, dateFrom, dateTo) {
return $.when(
$.ajax({
url: 'ajax',
dataType: 'json',
data: {
cls: ".....MedicationSearchController",
mtd: "getFreqDates",
ses: SessID,
frequencyKey: key,
startDate: dateFrom,
endDate:dateTo
}
})
).then(function(data){
if (data && data.success === true) {
return data.results;
} else {
// alert(data.exception);
}
});
}
getMedicationOrderInstanceseemsasyncto me..callbackorpromisevar tdValue = {}; getMedicationOrderInstance(freqKey, $.datepicker.formatDate('dd M yy', dateFrom), $.datepicker.formatDate('dd M yy', dateTo)).then(function(data){ tdValue = $.parseJSON(data)});