简体   繁体   中英

How to parse multi dimentional json response in ajax call

below is the json response which i'm getting,

{
    "day": ["Thursday", "Friday", "Saturday", "Sunday"],
    "date": ["03-01-2012", "03-02-2012", "03-03-2012", "03-04-2012"]
}

i want to parse it for day and date differently.

The success function is something like this, yes?

success: function(data) { // data represents here the ajax json response
  var days = data.day;
  var dates = data.date;
  // Here loop through them, or do anything else you like
}

Basically you can treat JSON responses just like any Javascript object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM