How to read json response as name value pairs in JQuery

大憨熊 提交于 2019-11-29 02:21:23
success: function(responseData) {
    for (var key in responseData) {
        alert(responseData[key]);
    }
}

It is important to note that the order in which the properties will be iterated is arbitrary and shouldn't be relied upon.

Arnaud F.

It's easy like this:

json = {"key1": "value1", "key2": "value2" };

$.each(json, function(key, value) { alert(key + "=" + value); });

You can just use responseData['name1']. Easy.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!