text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
between US Dollars and Canadian dollars | 5,698.01 | 4.2 |
in the pound in the euro and other | 5,700.65 | 3.839 |
currencies that exist as well and down | 5,702.21 | 4.02 |
below we have the base of what base | 5,704.489 | 4.17 |
currency we're converting from so all of | 5,706.23 | 4.8 |
this data can come back to me if I just | 5,708.659 | 4.381 |
make an HTTP request I make a web | 5,711.03 | 4.919 |
request to this particular URL I then | 5,713.04 | 5.22 |
get access to all of this currency | 5,715.949 | 4.561 |
exchange rate information that I can | 5,718.26 | 5.16 |
then use inside of my application so how | 5,720.51 | 4.74 |
can I do this how can I now begin to use | 5,723.42 | 4.17 |
this information inside of an | 5,725.25 | 4.8 |
application let's now create a new page | 5,727.59 | 7.109 |
I'm gonna call this currency HTML inside | 5,730.05 | 9.359 |
of currency about HTML at our usual HTML | 5,734.699 | 8.88 |
a title of currency exchange and a body | 5,739.409 | 7.23 |
and inside the body and we're just going | 5,743.579 | 4.921 |
to include nothing for now what I really | 5,746.639 | 3.721 |
care about is the JavaScript that is | 5,748.5 | 4.53 |
going to make a web request in order to | 5,750.36 | 5.1 |
get access to additional data | 5,753.03 | 4.83 |
so far in JavaScript our JavaScript code | 5,755.46 | 4.77 |
has exclusively been running code that | 5,757.86 | 5.28 |
exists only on our computer it's running | 5,760.23 | 4.739 |
inside the web browser and all happening | 5,763.14 | 3.21 |
inside the web browser we're not | 5,764.969 | 2.941 |
communicating with some external server | 5,766.35 | 3.33 |
what we'll take a look at now is | 5,767.91 | 3.75 |
something known as Ajax which was about | 5,769.68 | 3.87 |
asynchronous JavaScript where the idea | 5,771.66 | 4.02 |
is that even after a page has loaded | 5,773.55 | 5.189 |
using JavaScript we can make additional | 5,775.68 | 4.92 |
web requests to ask for additional | 5,778.739 | 4.051 |
information either from our own web | 5,780.6 | 3.9 |
servers or from some third party web | 5,782.79 | 3.69 |
servers if we want additional | 5,784.5 | 4.41 |
information on our page and what we want | 5,786.48 | 4.41 |
in this case is for our page to make an | 5,788.91 | 4.26 |
asynchronous request to request for | 5,790.89 | 4.71 |
additional data about the current | 5,793.17 | 5.88 |
currency exchange rates for example so | 5,795.6 | 5.25 |
how am I going to do that well I want to | 5,799.05 | 6.86 |
do this after the Dom content is loaded | 5,800.85 | 8.639 |
so we'll add that usually there and what | 5,805.91 | 4.75 |
we're going to take advantage of as a | 5,809.489 | 2.521 |
function built-in to more recent | 5,810.66 | 2.82 |
versions of JavaScript and supported by | 5,812.01 | 3.45 |
most major browsers now and if the | 5,813.48 | 4.56 |
function called fetch and what fetch is | 5,815.46 | 4.56 |
going to do is it is going to make a web | 5,818.04 | 4.02 |
request it is going to query some | 5,820.02 | 3.48 |
website it could be our own it could be | 5,822.06 | 3.36 |
someone else's and it's gonna get back | 5,823.5 | 5.13 |
some HTTP response from that page and | 5,825.42 | 5.28 |
I'm going to fetch in the page I'm going | 5,828.63 | 6.03 |
to fetch is this URL API not exchange | 5,830.7 | 6.57 |
rates API dot io / latest base equals | 5,834.66 | 4.68 |
USD and the only reason I happen to know | 5,837.27 | 3.78 |
how this API works is because I've read | 5,839.34 | 3.93 |
the api's documentation that describes | 5,841.05 | 4.59 |
how the URL parameters work and what the | 5,843.27 | 3.66 |
structure of the data that I get back | 5,845.64 | 4.17 |
isn't and so I'm here going to say go | 5,846.93 | 5.16 |
ahead and fetch from this URL make a | 5,849.81 | 4.62 |
HTTP request asking for additional | 5,852.09 | 5.43 |
information from this URL and get back | 5,854.43 | 4.95 |
what the results are going to be and | 5,857.52 | 4.68 |
what fetch gives back to us is something | 5,859.38 | 5.28 |
in JavaScript known as a promise and a | 5,862.2 | 3.96 |
promise is going to be a way of | 5,864.66 | 3.96 |
representing the idea that something is | 5,866.16 | 4.2 |
going to come back but it may not come | 5,868.62 | 3.69 |
back immediately we're not going to go | 5,870.36 | 3.33 |
into the details of exactly how those | 5,872.31 | 3.15 |
promises work but it turns out there's a | 5,873.69 | 3.45 |
particular syntax for dealing with them | 5,875.46 | 4.14 |
which is that I can say after I fetch I | 5,877.14 | 6.45 |
can add a line called dot then that says | 5,879.6 | 5.85 |
what should I do when the promise comes | 5,883.59 | 4.26 |
back once I get back something like a | 5,885.45 | 3.84 |
response | 5,887.85 | 3.39 |
and so when I get back the response what | 5,889.29 | 3.93 |
I want to do is convert the response | 5,891.24 | 5.22 |
into Jason treat it as Jason data Java a | 5,893.22 | 5.19 |
JavaScript object as something that I | 5,896.46 | 3.96 |
can then manipulate and so what I can do | 5,898.41 | 4.32 |
is just use this as a function to say go | 5,900.42 | 8.04 |
ahead and return response Jason and so | 5,902.73 | 7.68 |
what this is saying is go ahead and get | 5,908.46 | 4.5 |
me the latest exchange rates and then | 5,910.41 | 4.2 |
after that's done this is an | 5,912.96 | 3.18 |
asynchronous process it might take some | 5,914.61 | 3.78 |
time but once I get back those results | 5,916.14 | 4.89 |
then run this function take the response | 5,918.39 | 5.52 |
and return the jason version of the | 5,921.03 | 4.98 |
response convert that response into just | 5,923.91 | 4.5 |
the raw JSON data such that I can use | 5,926.01 | 4.32 |
that data to then access the currency | 5,928.41 | 3.96 |
exchange rates and it turns out that | 5,930.33 | 3.81 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.