views:

208

answers:

2

Hi I'm using fullcalendar, jQuery and CakePHP. When using the clientEvents function I get all of the calendar events in an array of objects. I then pass that array to an action via jQuery's $.ajax of type post. But when I inspect the post data I get something like:

Array
(
    [undefined] => undefined
)

What seems to be the problem?

Thanks in advance!

A: 

This probably means you're not building the array in Javascript correctly. Something like

values = myValues();  // getting values
var data = { };
data[values.variableThatDoesNotExist] = values.anotherVariableThatDoesNotExist;

The two non-existing variables are of type undefined, which gets cast to the string "undefined", and that's what the key and value in the object will be called.

Try debugging your Javascript.

deceze
A: 
$.post("/url/to/post/to",
       { post_param1: value1, post_param2: value2 }
       function(response) {
       }
});

Should work great...

dale