Javascript json:单击类别链接时,我只想显示该类别中的帖子

Javascript json:单击类别链接时,我只想显示该类别中的帖子,javascript,jquery,json,Javascript,Jquery,Json,我想获得分配给每个类别的帖子列表,并以slug作为链接显示标题,我不想硬编码类别名称,而是想获取分配给每个类别的每个帖子。我希望这是有意义的 我的问题是,如果该职位属于“所有合格退休计划”类别,我该如何比较 我想做的是。。。当我点击链接“#所有符合条件的退休计划”时,我只希望这些帖子显示“所有符合条件的退休计划”类别 函数AllQualifiedRetrientPlans(数据){ “严格使用”; var output='; $.each(data.posts、functio

我想获得分配给每个类别的帖子列表,并以slug作为链接显示标题,我不想硬编码类别名称,而是想获取分配给每个类别的每个帖子。我希望这是有意义的


我的问题是,如果该职位属于“所有合格退休计划”类别,我该如何比较

我想做的是。。。当我点击链接“#所有符合条件的退休计划”时,我只希望这些帖子显示“所有符合条件的退休计划”类别

函数AllQualifiedRetrientPlans(数据){ “严格使用”; var output='
    ; $.each(data.posts、function(key、val){ 输出+='
  • '; 输出+=''; 输出+='
  • '; })//浏览每一篇文章 输出+=“
”; $(“#所有符合条件的退休计划后列表”).html(输出);
//json

var data = {
      "status": "ok",
        "count": 24,
        "count_total": 24,
        "pages": 1,
        "posts": [
            {
                "id": 131,
                "type": "benefits",
                "slug": "highly-compensated-employee-hce",
                "url": "http://mywebsite.com/benefits/highly-compensated-employee-hce/",
                "status": "publish",
                "title": "Highly Compensated Employee (“HCE”)",
                "title_plain": "Highly Compensated Employee (“HCE”)",
                "content": "<p>Qualified Retirement Plans must not favor Highly Compensated Employees (HCEs). HCEs are used in testing for discrimination, such as testing employee and employer contributions under a 401(k) plan. An HCE is one who either: a) owns more than 5% of the organization, either directly or indirectly, no matter what that person’s pay is, or b) any employee whose pay from the organization, for the previous year, exceeds the amount shown below.</p>\n",
                "excerpt": "<p>Qualified Retirement Plans must not favor Highly Compensated Employees (HCEs). HCEs are used in testing for discrimination, such as testing employee and employer contributions under a 401(k) plan. An HCE is one who either: a) owns more than 5% of the organization, either directly or indirectly, no matter what that person’s pay is, or b) &hellip; <a href=\"http://mywebsite/benefits/highly-compensated-employee-hce/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Highly Compensated Employee (“HCE”)&#8221;</span></a></p>\n",
                "date": "2016-04-01 18:06:34",
                "modified": "2016-04-01 18:06:54",
                "categories": [
                    {
                        "id": 4,
                        "slug": "all-qualified-retirement-plans",
                        "title": "All Qualified Retirement Plans",
                        "description": "",
                        "parent": 1,
                        "post_count": 4
                    },
                    {
                        "id": 1,
                        "slug": "retirement-plans",
                        "title": "Retirement Plans",
                        "description": "",
                        "parent": 0,
                        "post_count": 13
                    }
                ],
                "tags": [],
                "author": {
                    "id": 1,
                    "slug": "keith",
                    "name": "keith",
                    "first_name": "",
                    "last_name": "",
                    "nickname": "keith",
                    "url": "",
                    "description": ""
                },
                "comments": [],
                "attachments": [],
                "comment_count": 0,
                "comment_status": "closed",
                "custom_fields": {
                    "extra_content_extra_content_title": [
                        ""
                    ],
                    "extra_content_extra_content_medicare": [
                        ""
                    ],
                    "extra_content_extra_content_percent_moved": [
                        " "
                    ],
                    "extra_content_extra_content_percent_value": [
                        ""
                    ],
                    "extra_content_extra_content_first_value": [
                        "2016: 120,000"
                    ],
                    "extra_content_extra_content_second_value": [
                        "2015: 120,000"
                    ],
                    "extra_content_extra_content_third_value": [
                        "2014: 115,000"
                    ],
                    "extra_content_extra_content_fourth_value": [
                        "2013: 115,000"
                    ],
                    "extra_content_extra_content_firth_value": [
                        "2012: 115,000"
                    ],
                    "extra_content_extra_content_sixth_value": [
                        "2011: 110,000"
                    ],
                    "extra_content_extra_content_seventh_value": [
                        "2010: 110,000"
                    ],
                    "extra_content_extra_content_eight_value": [
                        ""
                    ],
                    "extra_content_extra_content_nine_value": [
                        ""
                    ],
                    "extra_content_extra_content_ten_value": [
                        ""
                    ],
                    "social_security_social_security_title": [
                        ""
                    ],
                    "social_security_social_security_field_one": [
                        ""
                    ],
                    "social_security_social_security_field_two": [
                        ""
                    ],
                    "social_security_social_security_field_three": [
                        ""
                    ],
                    "social_security_social_security_field_four": [
                        ""
                    ],
                    "social_security_social_security_field_five": [
                        ""
                    ],
                    "social_security_social_security_field_six": [
                        ""
                    ],
                    "social_security_social_security_field_seven": [
                        ""
                    ],
                    "social_security_social_security_field_eight": [
                        ""
                    ],
                    "social_security_social_security_field_nine": [
                        ""
                    ],
                    "social_security_social_security_field_ten": [
                        ""
                    ],
                    "extra_content_three_title": [
                        ""
                    ],
                    "extra_content_three_field_one": [
                        ""
                    ],
                    "extra_content_three_field_two": [
                        ""
                    ],
                    "extra_content_three_field_three": [
                        ""
                    ],
                    "extra_content_three_field_four": [
                        ""
                    ],
                    "extra_content_three_field_five": [
                        ""
                    ],
                    "extra_content_three_field_six": [
                        ""
                    ],
                    "extra_content_three_field_seven": [
                        ""
                    ],
                    "extra_content_three_field_eight": [
                        ""
                    ],
                    "extra_content_three_field_nine": [
                        ""
                    ],
                    "extra_content_three_field_ten": [
                        ""
                    ]
                }
            }
};

allQualifiedRetirementPlans (data)
var数据={
“状态”:“确定”,
“计数”:24,
“总数”:24,
"页":一,,
“员额”:[
{
“id”:131,
“类型”:“福利”,
“slug”:“高薪员工hce”,
“url”:”http://mywebsite.com/benefits/highly-compensated-employee-hce/",
“状态”:“发布”,
“职务”:“高薪员工(HCE”),
“职位名称”:“高薪员工(HCE”),
“内容”:“合格退休计划不得有利于高薪雇员(HCE)。HCE用于测试歧视,例如根据401(k)计划测试雇员和雇主的供款计划。HCE是指以下人员:a)直接或间接拥有公司5%以上的股份,无论该人员的工资是多少;或b)公司上一年的工资超过以下金额的任何员工。

\n“, “节选”:“合格退休计划不得偏向高薪雇员(HCE)。HCE用于测试歧视,例如根据401(k)计划测试雇员和雇主的供款计划。HCE是指:a)直接或间接拥有组织5%以上股份的人,无论该人的工资是多少;或b)&hellip;

\n“, “日期”:“2016-04-01 18:06:34”, “修改”:“2016-04-01 18:06:54”, “类别”:[ { “id”:4, “slug”:“所有符合条件的退休计划”, “标题”:“所有合格退休计划”, “说明”:“, “家长”:1, “后计数”:4 }, { “id”:1, “slug”:“退休计划”, “标题”:“退休计划”, “说明”:“, “父项”:0, “后计数”:13 } ], “标签”:[], “作者”:{ “id”:1, “鼻涕虫”:“基思”, “姓名”:“基思”, “名字”:“, “姓氏”:“, “昵称”:“基思”, “url”:“, “说明”:” }, “评论”:[…], “附件”:[], “注释计数”:0, “评论状态”:“已关闭”, “自定义字段”:{ “附加内容附加内容标题”:[ "" ], “额外内容医疗保险”:[ "" ], “额外内容额外内容移动百分比”:[ " " ], “额外含量额外含量百分比值”:[ "" ], “额外内容额外内容第一个值”:[ "2016: 120,000" ], “额外内容额外内容第二个值”:[ "2015: 120,000" ], “额外内容额外内容第三值”:[ "2014: 115,000" ], “额外内容额外内容第四值”:[ "2013: 115,000" ], “额外内容额外内容价值”:[ "2012: 115,000" ], “额外内容额外内容第六值”:[ "2011: 110,000" ], “额外内容额外内容第七值”:[ "2010: 110,000" ], “额外内容额外内容八值”:[ "" ], “额外内容额外内容价值”:[ "" ], “额外内容额外内容十个价值”:[ "" ], “社会保障”社会保障名称:[ "" ], “社会保障”社会保障领域“第一”:[ ""
var data = {
      "status": "ok",
        "count": 24,
        "count_total": 24,
        "pages": 1,
        "posts": [
            {
                "id": 131,
                "type": "benefits",
                "slug": "highly-compensated-employee-hce",
                "url": "http://mywebsite.com/benefits/highly-compensated-employee-hce/",
                "status": "publish",
                "title": "Highly Compensated Employee (“HCE”)",
                "title_plain": "Highly Compensated Employee (“HCE”)",
                "content": "<p>Qualified Retirement Plans must not favor Highly Compensated Employees (HCEs). HCEs are used in testing for discrimination, such as testing employee and employer contributions under a 401(k) plan. An HCE is one who either: a) owns more than 5% of the organization, either directly or indirectly, no matter what that person’s pay is, or b) any employee whose pay from the organization, for the previous year, exceeds the amount shown below.</p>\n",
                "excerpt": "<p>Qualified Retirement Plans must not favor Highly Compensated Employees (HCEs). HCEs are used in testing for discrimination, such as testing employee and employer contributions under a 401(k) plan. An HCE is one who either: a) owns more than 5% of the organization, either directly or indirectly, no matter what that person’s pay is, or b) &hellip; <a href=\"http://mywebsite/benefits/highly-compensated-employee-hce/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Highly Compensated Employee (“HCE”)&#8221;</span></a></p>\n",
                "date": "2016-04-01 18:06:34",
                "modified": "2016-04-01 18:06:54",
                "categories": [
                    {
                        "id": 4,
                        "slug": "all-qualified-retirement-plans",
                        "title": "All Qualified Retirement Plans",
                        "description": "",
                        "parent": 1,
                        "post_count": 4
                    },
                    {
                        "id": 1,
                        "slug": "retirement-plans",
                        "title": "Retirement Plans",
                        "description": "",
                        "parent": 0,
                        "post_count": 13
                    }
                ],
                "tags": [],
                "author": {
                    "id": 1,
                    "slug": "keith",
                    "name": "keith",
                    "first_name": "",
                    "last_name": "",
                    "nickname": "keith",
                    "url": "",
                    "description": ""
                },
                "comments": [],
                "attachments": [],
                "comment_count": 0,
                "comment_status": "closed",
                "custom_fields": {
                    "extra_content_extra_content_title": [
                        ""
                    ],
                    "extra_content_extra_content_medicare": [
                        ""
                    ],
                    "extra_content_extra_content_percent_moved": [
                        " "
                    ],
                    "extra_content_extra_content_percent_value": [
                        ""
                    ],
                    "extra_content_extra_content_first_value": [
                        "2016: 120,000"
                    ],
                    "extra_content_extra_content_second_value": [
                        "2015: 120,000"
                    ],
                    "extra_content_extra_content_third_value": [
                        "2014: 115,000"
                    ],
                    "extra_content_extra_content_fourth_value": [
                        "2013: 115,000"
                    ],
                    "extra_content_extra_content_firth_value": [
                        "2012: 115,000"
                    ],
                    "extra_content_extra_content_sixth_value": [
                        "2011: 110,000"
                    ],
                    "extra_content_extra_content_seventh_value": [
                        "2010: 110,000"
                    ],
                    "extra_content_extra_content_eight_value": [
                        ""
                    ],
                    "extra_content_extra_content_nine_value": [
                        ""
                    ],
                    "extra_content_extra_content_ten_value": [
                        ""
                    ],
                    "social_security_social_security_title": [
                        ""
                    ],
                    "social_security_social_security_field_one": [
                        ""
                    ],
                    "social_security_social_security_field_two": [
                        ""
                    ],
                    "social_security_social_security_field_three": [
                        ""
                    ],
                    "social_security_social_security_field_four": [
                        ""
                    ],
                    "social_security_social_security_field_five": [
                        ""
                    ],
                    "social_security_social_security_field_six": [
                        ""
                    ],
                    "social_security_social_security_field_seven": [
                        ""
                    ],
                    "social_security_social_security_field_eight": [
                        ""
                    ],
                    "social_security_social_security_field_nine": [
                        ""
                    ],
                    "social_security_social_security_field_ten": [
                        ""
                    ],
                    "extra_content_three_title": [
                        ""
                    ],
                    "extra_content_three_field_one": [
                        ""
                    ],
                    "extra_content_three_field_two": [
                        ""
                    ],
                    "extra_content_three_field_three": [
                        ""
                    ],
                    "extra_content_three_field_four": [
                        ""
                    ],
                    "extra_content_three_field_five": [
                        ""
                    ],
                    "extra_content_three_field_six": [
                        ""
                    ],
                    "extra_content_three_field_seven": [
                        ""
                    ],
                    "extra_content_three_field_eight": [
                        ""
                    ],
                    "extra_content_three_field_nine": [
                        ""
                    ],
                    "extra_content_three_field_ten": [
                        ""
                    ]
                }
            }
};

allQualifiedRetirementPlans (data)