Bring JSON result into div with jquery

3

I have the following JSON generated by the system:

var skuJson = {
  "productId": 17234,
  "name": "Sabonete AnaSuil Porta Joias Rose Bulgarie",
  "salesChannel": "1",
  "available": true,
  "displayMode": "especificacao",
  "dimensions": [
   "Volume"
  ],
  "dimensionsInputType": {
    "Volume": "Combo"
  },
  "dimensionsMap": {
"Volume": [
  "130 g"
]
  },
  "skus": [
{
  "sku": 17235,
  "skuname": "130 g + Grátis Toalha Fitness Club",
  "dimensions": {
    "Volume": "130 g"
  },
  "available": true,
  "listPriceFormated": "R$ 125,50",
  "listPrice": 12550,
  "bestPriceFormated": "R$ 95,38",
  "bestPrice": 9538,
  "installments": 4,
  "installmentsValue": 2384,
  "installmentsInsterestRate": 0,
  "image": "http://develop-shopluxo.vtexcommercebeta.com.br/arquivos/ids/169135-292-292/Sabonete-AnaSuil-Porta-Joias-Rose-Bulgarie.jpg?v=634868637715300000",
  "sellerId": "1",
  "seller": "shopluxo",
  "measures": {
    "cubicweight": 0.2083,
    "height": 10.0000,
    "length": 10.0000,
    "weight": 63.0000,
    "width": 10.0000
  },
  "rewardValue": 0
}
  ]
     };CATALOG_SDK.setProductWithVariationsCache(skuJson.productId,
skuJson);

I need only bring the value of "skus": "sku": 17235 in a div with jQuery. What would be the way?

Note: The above values are in head within a script .

    
asked by anonymous 09.05.2014 / 23:29

1 answer

3

The value of "sku" can be obtained as follows:

skuJson.skus[0].sku

The contents of div can be set with jQuery as follows:

$('#ID-da-div').text(skuJson.skus[0].sku);
    
09.05.2014 / 23:40