Project Challenge 6: Import Tasks in the To-Do List from a Server

Import a list of tasks from a server with the help of an AJAX Get request and add the tasks at the end of the to-do list.

Problem statement

We have added a new “server” button on the webpage with the icon , and id set to import. In this challenge, the task is this:

  • When the user clicks on the “server” button element, import a list of tasks from an external server using a GET request.

  • Then, add the imported tasks one-by-one at the end of the to-do list on the webpage.

We will use the AJAX get() method in jQuery. The required parameters are:

  • The server URL to make the GET request is https://5f28559af5d27e001612eebf.mockapi.io/tasks/

  • The expected server response is of the data type “JSON.” The response object consists of two fields - id and tasks. tasks contains a list of tasks to be added to the to-do list. Check out the sample server response below.

    {
       "id": 1,
       "tasks": [
        "complete assignment",
        "study on educative",
        "reply to emails"
       ]
    }

Get hands-on with 1200+ tech skills courses.