Question: stuck on a homework assignment in a jquery.getJSON fuction When the button is clicked load the JSON file through an AJAX get request and then

stuck on a homework assignment in a jquery.getJSON fuction When the button is clicked load the JSON file through an AJAX get request and then display (append) that data to the web page through an unordered list.

edited the list I want to read it in to my project through a function. The function should be called when the user clicks the button with a id "getHobbies".

To do this add a button to your webpage and give it an id of "getHobbies"

HINTS

Think about the 'this' element for your function to only change the span clicked.

look at http://api.jquery.com/jquery.getjson/ for help with reading in the JSON file.

html code

Jason hosa

Hello my name is Jason hosa, i have been attending SWIC for two years now. My goal after SWIC is to be a Front-End Web Developer i plan on receiving an Associates degree in Applied science Web Development, And a Certificate in Web Coding At SWIC.

A list of Hobbies

    • Enjoy Ice Skating
    • Spending time with my wife and 6 year old Son Hunter
    • enjoy Sporting events
    • Coding

    few hobby links:

    Treehouse

    Metro rec Plex

    main.js code

    $(document).ready(function () { alert("Hello World"); $("span").click( function() { $("span").css("color", "#d49a9a"); $(this).css("color", "#c2c0c0"); }); });

    $(document).ready(function () {

    $("span").click(function () {

    TextColorChange($(this));

    });

    $("#nameToggle").click(function () {

    ToggleName($(this));

    });

    });

    TextColorChange = function (el) {

    el.css("color", "yellow");

    }

    // Function to toggle the name in the header

    function ToggleName(element) { $("h1").toggle(); // Toggle the name in the h1 tag }

    here is where i am stuck loading json

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!