postData not passing any parameters!
You current implementation of serializeGridData
just remove all functions parameters from the postData
. So you should either extend data
parameter inside of serializeGridData
instead of the usage of postData
. Another way is to modify serializeGridData
to the following:
serializeGridData: function (data){
var propertyName, propertyValue, dataToSend = {};
for (propertyName in data) {
if (data.hasOwnProperty(propertyName)) {
propertyValue = data[propertyName];
if ($.isFunction(propertyValue)) {
dataToSend[propertyName] = propertyValue();
} else {
dataToSend[propertyName] = propertyValue
}
}
}
return JSON.stringify(dataToSend);
}
In the code above we enumerate all properties and call all functions explicitly. Moreover I prefer to use JSON.stringify
function from json2.js. The function will be native implemented in many web browsers.
See the demo here.