Показать сообщение отдельно
  #4 (permalink)  
Старый 14.09.2016, 11:33
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,124

Win_D,
<script>
data = {
    "status": "ok",
    "product": {
        "id": 63863999,
        "url": "/collection/tumby/product/porta-due-tumba-dlya-tv-i-multimedia",
        "title": "Porta Due \u0442\u0443\u043c\u0431\u0430 \u0434\u043b\u044f \u0422\u0412 \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0434\u0438\u0430",
        "short_description": null,
        "available": true,
        "unit": "pce",
        "permalink": "porta-due-tumba-dlya-tv-i-multimedia",
        "images": [],
        "first_image": {
            "created_at": null,
            "id": null,
            "image_processing": null,
            "position": null,
            "product_id": null,
            "title": null,
            "url": "/images/no_image_thumb.jpg",
            "original_url": "/images/no_image_original.jpg",
            "medium_url": "/images/no_image_medium.jpg",
            "small_url": "/images/no_image_micro.jpg",
            "thumb_url": "/images/no_image_thumb.jpg",
            "compact_url": "/images/no_image_compact.jpg",
            "large_url": "/images/no_image_large.jpg",
            "filename": null
        },
        "category_id": 5295614,
        "canonical_url_collection_id": 5766160,
        "price_kinds": [],
        "description": null,
        "option_names": [],
        "properties": [{
            "backoffice": true,
            "id": 1709416,
            "is_hidden": false,
            "is_navigational": false,
            "position": 0,
            "permalink": "srok-dostavki",
            "title": "\u0421\u0440\u043e\u043a \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438"
        }, {
            "backoffice": true,
            "id": 1698924,
            "is_hidden": false,
            "is_navigational": false,
            "position": 1,
            "permalink": "mesto-proizvodstva",
            "title": "\u041c\u0435\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430"
        }, {
            "backoffice": true,
            "id": 1553533,
            "is_hidden": true,
            "is_navigational": false,
            "position": 2,
            "permalink": "proizvoditel",
            "title": "\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c"
        }, {
            "backoffice": true,
            "id": 1553534,
            "is_hidden": true,
            "is_navigational": false,
            "position": 3,
            "permalink": "postavschik",
            "title": "\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a"
        }, {
            "backoffice": true,
            "id": 1709429,
            "is_hidden": false,
            "is_navigational": false,
            "position": 54,
            "permalink": "instruktsiya-po-sborke",
            "title": "\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435"
        }, {
            "backoffice": true,
            "id": 1704278,
            "is_hidden": false,
            "is_navigational": false,
            "position": 55,
            "permalink": "garantiynyy-srok",
            "title": "\u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0439\u043d\u044b\u0439 \u0441\u0440\u043e\u043a"
        }],
        "characteristics": [{
            "id": 17600148,
            "property_id": 1709429,
            "position": 1,
            "title": "\u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f",
            "permalink": "prilagaetsya-podrobnaya-shema-i-spetsifikatsiya"
        }, {
            "id": 17697352,
            "property_id": 1704278,
            "position": 3,
            "title": "24 \u043c\u0435\u0441\u044f\u0446\u0430",
            "permalink": "24-mesyatsa"
        }, {
            "id": 17600109,
            "property_id": 1709416,
            "position": 1,
            "title": "15 \u0434\u043d\u0435\u0439",
            "permalink": "15-dney"
        }, {
            "id": 17397390,
            "property_id": 1553534,
            "position": 1,
            "title": "\u0410\u043b\u0441\u043e",
            "permalink": "also"
        }, {
            "id": 17496852,
            "property_id": 1698924,
            "position": 8,
            "title": "\u0418\u0436\u0435\u0432\u0441\u043a",
            "permalink": "izhevsk"
        }, {
            "id": 17219116,
            "property_id": 1553533,
            "position": 24,
            "title": "\u041c\u0421\u0422",
            "permalink": "mst"
        }],
        "variants": [{
            "id": 99532267,
            "available": true,
            "product_id": 63863999,
            "title": "",
            "base_price": "11600.0",
            "prices": [],
            "price": "11600.0",
            "old_price": null,
            "sku": "4PA0TM4C1",
            "barcode": null,
            "option_values": [],
            "quantity": null,
            "weight": null,
            "created_at": "2016-08-09T11:10:18+03:00",
            "updated_at": "2016-08-18T08:34:32+03:00"
        }]
    }
}

function success(data) {
var id = 1553534, title;
data.product.characteristics.some(function(el) {
   if (el.property_id == id) title = el.title;
   return title
})
alert(title)
}
success(data)
 </script>
Ответить с цитированием