Can anyone help with this task? Thanks
Please perform an AJAX request for the URL inside test_url variable and list all messages (socialProof[i].messages.message) under the div#list element when the “List Messages” button is clicked. You can browse the url from your browser to see the JSON response.
What have you tried so far? Since jQuery is already included in your code, have you tried using it to do an AJAX request? I’m not talking yet about making the request when you click the button.
Basically it will boil down to the following:
- Perform an AJAX request with jQuery right when the page loads, then printing the result to the console.
- Adding a click listener to the button. Just make it print something to the console.
- Now instead of printing to the console, make the button click perform the AJAX request.
- Now instead of printing the whole JSON response to the console, find a way to somehow extract just the data that you need, then print just that.
- After that, find a way to display it in the
I recommend reading the jQuery docs. Particularly for items 1, 2 and 5.