How can I refresh a div with a button click?

HTML

<button id="button">Refresh</button>
<div id='loading'>Loading...</div>
<div id='iconsfree'></div>

CSS

#loading {
    
    font-size: 40px;
    color: red;
}

JavaScript

$(document).ready(function() { 

    function refresh(){
        $("#loading").show();
        $.getJSON("/echo/json/",function(data) {
            var div_data = 'Some awesome content loaded from server!';
            // removed response data loop, as for the jsfiddle demo.
            $("#iconsfree").html(div_data);
            $("#loading").hide();
        });
    }

    // call the method on button click:
    $(document).on('click', '#button', function(e){
          e.preventDefault();
          refresh();
    });

    // call the method when page is opened:
    refresh();

});