[SOLVED] Get JSON with the jQuery getJSON Method--Please give some advices

[SOLVED] Get JSON with the jQuery getJSON Method--Please give some advices
0

#1

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:

when I clicked the “Get Message” button, there is nothing happened, and when I submitted the code,
the result is as the picture below:
image

I am new to JSON and I got confused by the task, please give me some help.Thanks a lot!


#2

You forgot a $ before ('#getMessage').


#3

you are right. Thanks a lot!