[jQuery] Problems parsing posted array of objects
Hello,
I have this on my client-side:
<script language="javascript" type="text/javascript">
function BigAction(inputdata) {
var url = 'index2.php';
$('#progressIndicator').show('fast', function () {
$.post(url, inputdata,
function(data) {
$.each(data.items, function(i,item){
$(item.id).html(item.html);
});
$('#progressIndicator').hide('fast');
}, "json");
});
return false;
}//function BigAction(inputdata) {
</script>
<a href="#" onclick='BigAction({"items[]":[{ys:"content",
action:"view"},{ys:"other",action:"onemore"}]}); return false;'>Get
content</a>
and I'm only using var_dump($_POST) for now on index2.php
This is what I get:
array(1) {
["items"]=>
array(2) {
[0]=>
string(15) "[object Object]"
[1]=>
string(15) "[object Object]"
}
}
My question would be: why $_POST['items'][0] is not something like:
ys=>"content"
action=>"view"
What am i missing?