I am trying to finish the task, my code as follow:
Your code so far
<script>
$(document).ready(function() {
("#getMessage").on("click", function(){
// Only change code below this line.
$.getJSON("/json/cats.json", function(json) {
$(".message").html(JSON.stringify(json));
});
// Only change code above this line.
});
});
</script>
<div class="container-fluid">
<div class = "row text-center">
<h2>Cat Photo Finder</h2>
</div>
<div class = "row text-center">
<div class = "col-xs-12 well message">
The message will go here
</div>
</div>
<div class = "row text-center">
<div class = "col-xs-12">
<button id = "getMessage" class = "btn btn-primary">
Get Message
</button>
</div>
</div>
</div>
Your browser information:
Link to the challenge:
https://www.freecodecamp.org/challenges/get-json-with-the-jquery-getjson-method
when I clicked the “Get Message” button, there is nothing happened, and when I submitted the code,
the result is as the picture below:
I am new to JSON and I got confused by the task, please give me some help.Thanks a lot!