Hi there,
I was trying to create a prototype object with four attributes: 'name', 'basis' and 'rows', which are values taken from a form and 'head' which should be an array of string values.
Classdef:
var TableTemplate = Class.create();
TableTemplate.prototype = {
initialize: function(name, basis, head, rows) {
this.name = name;
this.basis = basis;
this.head = head;
this.rows = rows;
},
};
It should be passed to a .php file in the backend as following:
function sendRequest() {
var sorting = doSorting();
//alert(sorting.inspect());
var table = new TableTemplate($F('templateName'), $F('basisTemplate'), sorting , $F('maxRows'));
new Ajax.Request("test.php",
{
method: 'post',
postBody: 'table='+ Object.toJSON(table),
onComplete: showResponse
});
}
where 'doSorting()' returns a stringarray.
Problem: I can't seem to get other attributes than the head (array) in the object, or this one kinda overwrites the others... When I try to get a name or basis, the array will be returned.
Has anyone an idea how to solve this? Thanks in advance for your help,
Mara