1

I'm trying to get from API the data and don't know how.

So I am trying to use this API https://api.abalin.net/get/today?country=cz and don't know really how.

<div id="data"></div>

<script type="text/javascript">
    $.get("https://api.abalin.net/get/today?country=cz", function(data){




            $("#data").append(data.results[0].name_cz );
        }           
    )
</script>
2

1 Answer 1

2

The response is an object that has property data and not results.

$.getJSON() is also a better ajax shortcut method for making json GET requests.

$.getJSON("https://api.abalin.net/get/today?country=cz", function(res) {
  console.log('name_cz = ', res.data.name_cz);
  console.log('month = ', res.data.month);
  
  $('#data').text(res.data.name_cz);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="data"></div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.