not able to access json data
HI,
i am not able to access the json data through query. Please let me know why.. i have tried so may ways.
below is my script:
- $(document).ready(
- function () {
- $.getJSON("new.json",function(data)
- {
- var html = "";
- alert(data[0].content[1].css);
- for(var i=0,size=data.length;i<size;i++){
- alert("pallavi" +data.length);
- html += '<div class='+data[0].content[i].css+' id='+data[0].content[i].id+'></div>';
- }
- $('#clickCall').append(html);
- });
- });
below is my json:
- [
- {
- {
- "content": [
- {
- "content": [
- {
- "content": [
- {
- "content": {
- "attrs": {
- "alt": "",
- "src": "../images/callnow.png"
- },
- "type": "img"
- }
- },
- {
- "content": {
- "content": {
- "text": "Call"
- },
- "css": "labelBox1",
- "type": "h3"
- }
- },
- {
- "content": {
- "content": {
- "text": "Talk us now or later. You can also share screens with an advisor."
- },
- "type": "p"
- }
- }
- ],
- "css": "box2",
- "id": "box2"
- },
- {
- "content": [
- {
- "content": {
- "attrs": {
- "alt": "",
- "src": "../common/images/service.jpg"
- },
- "css": "box3img",
- "type": "img"
- }
- },
- {
- "content": {
- "content": {
- "text": " Take in for Service"
- },
- "css": "labelBox2",
- "type": "h3"
- }
- },
- {
- "content": {
- "content": {
- "text": "Find a local Apple Authorized Service Provider or make an reservation at the Genius Bar. "
- },
- "type": "p"
- }
- }
- ],
- "css": "box3"
- },
- {
- "content": [
- {
- "content": {
- "attrs": {
- "alt": "",
- "src": "../images/icon_carrier.png"
- },
- "type": "img"
- }
- },
- {
- "content": {
- "content": {
- "text": "Contact Carrier"
- },
- "css": "labelBox3",
- "type": "h3"
- }
- },
- {
- "content": {
- "content": {
- "text": "Temper incididunt ut labore et dolore magna eliqua"
- },
- "type": "p"
- }
- }
- ],
- "css": "box4"
- }
- ],
- "css": "wrapperbox1",
- "id": "clickCall"
- }
- ]
-
- }
- }
- ]
Thanks!