Solved

How display the following JSON object in html using Jquery

Posted on 2011-09-19
1
335 Views
Last Modified: 2012-05-12
hi, I have the following JSON object I need to display it using Jqury as a list of links like the following format:
1- <a href="Article_Url">Article_Title</a>
2- <a href="Article_Url">Article_Title</a>
...
Here is the JSON object:
{{"Columns":["id","Article_Url","Article_Title","Date","num"],"Rows":[["5bb93b83-d129-4ca9-8999-ed54910b824d","www.fomain.com//test.html","test","\/Date(1316189236173)\/",25],["82d62b61-d96b-489a-ae91-008b897db553","97.74.67.146/testx.html?xx=x","test","\/Date(1316256259490)\/",11],["97aaf346-1146-429e-bc5a-fcfa4b2d934b","97.74.67.146/testx.html","test","\/Date(1316255702510)\/",4],["2fea1222-e254-4db9-a68e-5129a0d87e8e","97.74.67.146/qn_news_story_s.asp?storyid=1093442005","Oman invests USD3.8b in constructing dry dock","\/Date(1316188504010)\/",2],["82fe900d-eefe-4540-87a4-1fe6057234a7","http://www.menafn.com/qn_news_story.asp?StoryId={83510500-a24b-4f87-9bf1-3985134ee4b6}","Title 1","\/Date(1315411910897)\/",1]]} 

Open in new window

0
Comment
Question by:Sindibad_123
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36562864
you need to remove the first accolade : {
{"Columns":["id","Article_Url","Article_Title","Date","num"],"Rows":[["5bb93b83-d129-4ca9-8999-ed54910b824d","www.fomain.com//test.html","test","\/Date(1316189236173)\/",25],["82d62b61-d96b-489a-ae91-008b897db553","97.74.67.146/testx.html?xx=x","test","\/Date(1316256259490)\/",11],["97aaf346-1146-429e-bc5a-fcfa4b2d934b","97.74.67.146/testx.html","test","\/Date(1316255702510)\/",4],["2fea1222-e254-4db9-a68e-5129a0d87e8e","97.74.67.146/qn_news_story_s.asp?storyid=1093442005","Oman invests USD3.8b in constructing dry dock","\/Date(1316188504010)\/",2],["82fe900d-eefe-4540-87a4-1fe6057234a7","http://www.menafn.com/qn_news_story.asp?StoryId={83510500-a24b-4f87-9bf1-3985134ee4b6}","Title 1","\/Date(1315411910897)\/",1]]} 

Open in new window


else use :
    $.each(json["Rows"], function(i,el) {
        $("#here").append("<a href=\"" + el[1] + "\">" + el[2] + "</a><br />");  
    })

TEST PAGE : http://jsfiddle.net/DxHQr/
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question