I’m a noob to JSON, and would like to do a foreach through all the variables that are given to the callback after a user of my Facebook application invites many users to it, using Requests 2.0
According to Facebook, this is the callback that is received.
{
"request_ids": [
0: "[request_id]",
1: "[request_id]"
]
}
When I try to validate that with JSON Lint, it comes up as invalid. That doesn’t help me at all. I understand that the JSON is stored in a variable called response. You can look that up here.
I want to do a foreach of all the request id’s so that it’ll go something like this. Damn I don’t know how to do for/foreach loops in javascript.
for (response["*"] key in response){
document.write("ajaxcontrols.php?createSlapAction=REQUEST_ID");
}
Do a loop like this: