好吧,我想处理从一个jQuery请求的JSON响应内返回另一个JavaScript要求的foreach值,下面是当前的代码我使用这个请求的ForEach数组值
function waitForEvents(){
$.ajax({
type: "GET",
url: "/functions/ajax.php?func=feed&old_msg_id="+old_msg_id,
async: true, /* If set to non-async, browser shows page as "Loading.."*/
cache: false,
timeout:50000, /* Timeout in ms */
success: function(data){
var json = jQuery.parseJSON(data);
**//Foreach json repsonse['msg_id'] call another function**
setTimeout('waitForEvents()',"1000");
},
error: function (XMLHttpRequest, textStatus, errorThrown){
alert("Error:" + textStatus + " (" + errorThrown + ")");
setTimeout('waitForEvents()',"15000");
},
});
};
为每个JSON响应变量['msg_id']我想调用另一个JavaScript函数,但不知道如何处理在JavaScript中使用foreach的数组,任何想法如何?
的[我有一个嵌套的数据结构/ JSON,我怎么能访问可能重复具体的价值?](http://stackoverflow.com/questions/11922383/i-have-a-nested-data-structure-json-how-can-i-access-a-specific-value) – 2013-02-10 14:55:30