Practical 7: AJAX

1. Clone repository :

git clone https://github.com/tsotnekekelia/wad20-lab-7.git

Tasks

1. Dynamically load courses information from data/courses.json file just like it's done for user info

2. Make "+" button clickable so that it shows/hides form to add new course

3. When clicking "Add" button, in the form, entered information should appear in the table:

  • Send course data using POST method to https://wad20-lab7.free.beeceptor.com/users/1/courses
    Request body example:

{

"title": "title",

"semester": 2,

"grade": 75

}

  • GPA on "Profile" container needs to be updated as well (depending on the grade you enter)

  • After saving form needs to be reset (all the entered information cleared out) and form needs to be hidden

Formula to calculate GPA:

  • if grade > 90 point = 4

  • if grade > 80 point = 3

  • if grade > 70 point = 2

  • if grade > 60 point = 1

  • if grade > 50 point = 0.5

  • if grade <= 50 point = 0

GPA = sum of all points / (number of courses)

4. When clicking on "Cancel" button, in the form, entered information should disappear and form should be hidden