logo

Question detail

Explain how a browser JavaScript program can use a REST-based web application to update data in a database. Include the roles of the HTML file, REST API, HTTP method and SQL operation.

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

Question

Type

practice

Style

Topic

The Transmission Control Protocol/Internet Protocol (TCP/IP)

Exam-style question

Try this first

Explain how a browser JavaScript program can use a REST-based web application to update data in a database. Include the roles of the HTML file, REST API, HTTP method and SQL operation.

Model answer

What a good answer should say

  • The JavaScript is referenced by an HTML file, such as index.html, and runs in the browser.
  • The JavaScript sends an HTTP request to a REST API that has been created and is running on the server.
  • To update data, the request uses the PUT HTTP method.
  • REST maps PUT to the SQL UPDATE operation, so the server-side API can update the relevant database data.

Explanation

Why this works

A complete answer connects the browser-side JavaScript to the server-side REST API and identifies the specified mapping PUT to UPDATE. It should also recognise that the HTML file references the JavaScript and that communication uses HTTP.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.