JSON返回[对象的对象] [英] JSON returning [object Object]

查看:179
本文介绍了JSON返回[对象的对象]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从指定的URL返回的JSON数据,但是当警报弹出它只是显示[对象的对象](我认识的对象的对象其实也不是一个错误)。 我想吐出职位名称等多个领域,在警报。如何做到这一点?

I am trying to return the JSON data from the specified URL but when the alert pops up it just shows [object Object] (I realize the object object is not in fact an error). I would like to spit out the position name and other fields in the alert. How do I do this?

下面是我在看(完整的文件大约有30贴子)

Here is an example of the JSON I am looking at (the full file has about 30 postings)

[
  {
    "m_id": 473644,
    "m_positionName": "Application Monitoring Software Engineer",
    "m_positionLocations": [
      {}
    ],
    "m_active": true,
    "m_description": "Job Responsibilities:\r\n\r\n-Create world class application monitoring tools and dashboards for our health care applications\r\n\r\n-Develop business rules to pro actively identify and re-mediate system-level issues before they occur.\r\n\r\n-Create business intelligence reports for internal and external use as a supplement to software products.\r\n\r\n\r\n\r\nJob Requirements:\r\n\r\n-BS or MS Degree in computer science or any engineering discipline.\r\n-4+ years of experience with Java (or other object-oriented programming language).\r\n-Experience in SQL, Struts, Hibernate, Spring, Eclipse, JSP, JavaScript.\r\n-Highly motivated and self-driven personality.\r\n-Excellent interpersonal and leadership skills.\r\n-A vision for the future and a desire to make a difference.\r\n-Experience with Maven, Tomcat, PostgreSql, Jasper Reports,",
    "m_postedDate": "Jun 29, 2012 9:17:19 AM",
    "m_closingDate": "Jun 29, 2013 12:00:00 AM"
  }
]

这里是我使用的脚本。

And here is the script I am using.

 $.ajax({
 type: "GET",
 url: '/wp-content/themes/twentyeleven/js/jobopenings.json',
 async: false,
 beforeSend: function(x) {
  if(x && x.overrideMimeType) {
   x.overrideMimeType("application/j-son;charset=UTF-8");
  }
 },
dataType: "json",
success: function(data){
alert(data);
}
});

任何帮助是非常AP preciated。

Any Help is much appreciated.

推荐答案

试试这个:

success: function(data)
{
  var _len = data.length;
  , post, i;

  for (i = 0; i < _len; i++) {
    //debugger
    post = data[i];
    alert("m_positionName is "+ post. m_positionName);
  }
}

这篇关于JSON返回[对象的对象]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆