AjaxJson helper method From http://www.codeproject.com/Articles/658330/Data-grid-using-Knockout-JS-with-paging-and-sortin
AjaxJsonPostCall = function (fullUrl, dataObj, callbackFunction) {
$.ajax({
type: 'post',
url: fullUrl,
data: JSON.stringify(dataObj),
dataType: 'json',
cache: false,
success: function (data) { callbackFunction(GetJson(data)); },
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log("error :" + XMLHttpRequest.responseText);
alert('There was an error in performing this operation.');
}
});
};
GetJson = function (data) {
if (data == '' || data == 'undefined') return null;
return (JSON && JSON.parse(data) || $.parseJSON(data));
};