weixin_33698043 2011-10-12 05:55 采纳率: 0%
浏览 16

处理AJAX中的JSON输出

How to process JSON output in AJAX?

Reiterating on the same question asked yday(Above link),I seem to have more clarity now.

I get JSON output in 'data' var query = getDomainURL() + "/ProgramCalendar/GetJSONData";

  $.post(query, null, function (data) {...}

Now i Need to loop through the nodes and Identify 'Key' based on the names, and do some action for the 'val'

$.each(data, function(key, val) { ... } Can it be done using something similar with $.each, can you let me know the exact syntax?

Thanks, Adarsh

  • 写回答

1条回答 默认 最新

  • weixin_33727510 2011-10-12 06:01
    关注

    If the server returns a JSON array you could use $.each:

    $.each(data, function(index, item) {
        // item represents the current element of the array
        // here you can access its properties like
        alert(item.EventText);
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64