I am using jQuery with jqgrid and I wanted to use few value from the edit results. The result of the edit is a multidimensional array. For some reason I can only alert up to the second child, the result goes undefined if i go any further.
The main array variable is postdata and if i have to iterate this using jQuery's .each() function, I get these:
(item : value) format. the number is for the order of appearance
1 readyState : 4
2 setRequestHeader : function({....})
..
..
..
21 responseText : Array (
[id] => 364
[oper] => edit
[note] => editing
[client] => raha
)
My intention is to get the value of id but if i have to alert the array outside the .each() function using this:
alert(postdata['responseText']['id'])
The alert result is undefined. If I removed the ['id'], it shows the entire responseText array (same with number 21).
How do I accomplish this task? many thanks.
SOLVED!
Thanks to @Felix for the idea and to @Jasper for suggesting about the console.log.
The result of the jqGrid responseText is in double quotes, which makes it a string. I managed to solve this using the .split() function, two splits to be exact. First splitting it by '\n' and then by '=>'. I finally got what I wanted.
Thanks all
postdata['responseText']? I suspect it is a string, as that Array stuff looks like what php's print_r outputs when given an array.