У меня есть некий файл содержащий JSON response и страница сайта.
Используя страницу мне нужно вставить рекомендации прдукта динамически на эту самую страницу
, заменяя разделы продуктов, изначально находящиеся на странице.
Файл нельзя напрямую прочитать в JavaScript.
Файл следующего типа:
{
"placements":[
{
"strategy_message":"People who viewed this item also viewed",
"recs":[
{
"pid":"Prod_1000",
"ct_url":"https://imgur.com/",
"name":"Product 1",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$10.99"
},
{
"pid":"Prod_2001",
"ct_url":"https://imgur.com/",
"name":"Product 2",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$4.99"
},
{
"pid":"Prod_1202",
"ct_url":"https://imgur.com/",
"name":"Product 3",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$12.99"
}
]
},
{
"strategy_message":"People who bought this item also bought",
"recs":[
{
"pid":"Prod_1010",
"ct_url":"https://imgur.com/",
"name":"Product 1",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$100.99"
},
{
"pid":"Prod_1011",
"ct_url":"https://imgur.com/",
"name":"Product 2",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$30.99"
},
{
"pid":"Prod_1012",
"ct_url":"https://imgur.com/",
"name":"Product 3",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$20.99"
},
{
"pid":"Prod_1013",
"ct_url":"https://imgur.com/",
"name":"Product 4",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$16.99"
},
{
"pid":"Prod_1014",
"ct_url":"https://imgur.com/",
"name":"Product 5",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$22.99"
},
{
"pid":"Prod_1015",
"ct_url":"https://imgur.com/",
"name":"Product 6",
"img":"https://i.imgur.com/kKZXa2u.jpg",
"price":"$22.99"
}
]
}
]
}