From the course: Code Clinic: JavaScript

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Passing information to our database

Passing information to our database - JavaScript Tutorial

From the course: Code Clinic: JavaScript

Start my 1-month free trial

Passing information to our database

- [Speaker] So though we're getting some information from our database, we need to be able to pass along some values to our database in order to get the right information. So what I'm gonna do is create a few variables here. So be a let and then fromDate, and we'll just plug in a value here. And then we'll create a fromTime. And then we'll need some values for what happens... At the end of the range, so toDate and toTime, and, I'm just gonna make this, 10 here so it'll be like 1:00 a.m, and 10:00 a.m. And what I want to do is add a body method here, so, in this fetch command I can do a very simple fetch with just a URL, and because this is GAT and we're getting some information, that would just fine if we do want to pass along information, then we'll need to use something like POST method. And once we do that, we need to specify a body. And this is essentially what you're going to be sending to the database. So here, we're gonna need to use a method called JSON stringify, to convert…

Contents