I have looped through a simple gathering data and pushing it into an array. I am then trying to send that array to a page method (.aspx). There is something about the array that it does not like I think. Here is my code:
//packaging table data for submit to server
$("#saveToDB").click(function() {
var dataForSubmit = new Array();
//gather all data to array except the "delete" cell, .rowToDelete
$('#QueueTable tbody td:not(.rowToDelete)').each(function() {
dataForSubmit.push($(this).html());
});
//test the array
//alert(dataForSubmit);
//send array to method
$.ajax({
type: "POST",
url: "DailyReceipts.aspx/saveData",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: dataForSubmit,
success: function(msg) {
$.jGrowl('Your data has been successfully saved.', { header: 'Important' });
$('#result').append(msg.d)
},
error: function() {
$.jGrowl('An error has occured in saving the data.', { header: 'Important' });
}
});
});