How to loop through an JSON associative array in javascript?

前端 未结 6 778
遥遥无期
遥遥无期 2021-02-04 10:50

I\'m getting a JSON response from the server and i have to loop through the array in javascript and get the values. But I cant seem to loop throught it.

The JSON respons

6条回答
  •  忘了有多久
    2021-02-04 11:06

    http://jsfiddle.net/sG5sF/

    jQuery.each works fine. So is for-each loop

    http://jsfiddle.net/TfjrS/

    Both of them work as they should. You might have errors in other parts of your code. Is the response variable set correctly to the JSON object given in your question? Are you checking the response statusCode? it should be 200 for a successful response?

提交回复
热议问题