Answer the question
In order to leave comments, you need to log in
There is an API request in the form of a link and there is an answer, how to issue it?
how to make js access by link and style the result (response) with css styles?
For example request:
http://api.travelpayouts.com/v2/prices/latest?currency=rub&period_type=year&page=1&limit=30&show_to_affiliates=true&sorting=price&trip_class=0&token=
Answer the question
In order to leave comments, you need to log in
HTML:
<div id='templates' style='display:none;'>
<div class='latest-price'>
<div class='price-value'></div>
</div>
</div>
$.getJSON(url,
function(dt){
if (dt.success){
var template = $('#templates > div');
var clone = template.clone();
clone.find('.price-value').text(dt.data[0].value);
clone.appendTo($('#parent-block'));
}
});
.latest-price .price-value{
color: red;
}
<html>
<body>
<style>CSS</style>
<div>
<div id='parent-block'></div>
Код выше
</div>
<script>Javascript </script>
</body>
</html>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question