好吧,我想處理從一個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