From 31f8b7e4a65fb61f627712517aa27bd160a39642 Mon Sep 17 00:00:00 2001
From: Matt
Date: Sun, 10 Jun 2018 11:43:50 +0100
Subject: [PATCH 1/3] Fetched film results
---
README.md | 4 ++--
index.html | 22 ++++++++++++++++++++++
main.js | 20 ++++++++++++++++++++
styles.css | 3 +++
4 files changed, 47 insertions(+), 2 deletions(-)
create mode 100644 index.html
create mode 100644 main.js
create mode 100644 styles.css
diff --git a/README.md b/README.md
index 63943da3..183518ab 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@ To get started, fork and clone the repo at [https://github.com/dmitrigrabov/proj
You should complete as many of the following tasks as you can.
-- [ ] Create an HTML page which should have a `form` at the top which contains a text input and a submit button. Below it should have a placeholder for the returned results.
-- [ ] Use JavaScript to capture the submit `event` in your search form, extract the query string from your input and use that to make an API call to the Open Movie Database API to search for films which match the query string using `fetch`. `console.log` the results
+- [x] Create an HTML page which should have a `form` at the top which contains a text input and a submit button. Below it should have a placeholder for the returned results.
+- [x] Use JavaScript to capture the submit `event` in your search form, extract the query string from your input and use that to make an API call to the Open Movie Database API to search for films which match the query string using `fetch`. `console.log` the results
- [ ] Display the data returned by the API including title, year and poster picture
- [ ] Adjust your layout to create room for a detailed view of movie information
- [ ] Capture clicks on your movie results items and use that information to make another request to the API for detailed movie information. `console.log` the returned result
diff --git a/index.html b/index.html
new file mode 100644
index 00000000..34e70802
--- /dev/null
+++ b/index.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/main.js b/main.js
new file mode 100644
index 00000000..914b26ce
--- /dev/null
+++ b/main.js
@@ -0,0 +1,20 @@
+const queryFilmForm = document.getElementById("query-film");
+queryFilmForm.addEventListener("submit", function(e) {
+ e.preventDefault();
+ const filmResult = document.getElementById("submit-text").value
+ document.getElementById("film-result").innerHTML = filmResult
+ //base url Below
+ const apiUrl = "http://www.omdbapi.com/?apikey=e39b8524&type=movie&s=" + filmResult;
+ console.log(apiUrl);
+ //Api fetch
+ fetch(apiUrl)
+ // .then((res) => {
+ // return res.json()
+ // }) see below side by side use of old school JS and then arrow function
+ .then(function(res){
+ return res.json();
+ })
+ .then((apiJson) => {
+ console.log(apiJson);
+ })
+});
diff --git a/styles.css b/styles.css
new file mode 100644
index 00000000..6c8614e0
--- /dev/null
+++ b/styles.css
@@ -0,0 +1,3 @@
+.heading{
+
+}
From 50d7349c996e1329d2e85c97c2331cec85376643 Mon Sep 17 00:00:00 2001
From: Matt
Date: Sun, 10 Jun 2018 21:51:40 +0100
Subject: [PATCH 2/3] Working site with results showing
---
README.md | 2 +-
index.html | 14 ++++++++++++--
main.js | 36 ++++++++++++++++++++++++++++--------
styles.css | 33 +++++++++++++++++++++++++++++++--
4 files changed, 72 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index 183518ab..6b683d9a 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ You should complete as many of the following tasks as you can.
- [x] Create an HTML page which should have a `form` at the top which contains a text input and a submit button. Below it should have a placeholder for the returned results.
- [x] Use JavaScript to capture the submit `event` in your search form, extract the query string from your input and use that to make an API call to the Open Movie Database API to search for films which match the query string using `fetch`. `console.log` the results
-- [ ] Display the data returned by the API including title, year and poster picture
+- [x] Display the data returned by the API including title, year and poster picture
- [ ] Adjust your layout to create room for a detailed view of movie information
- [ ] Capture clicks on your movie results items and use that information to make another request to the API for detailed movie information. `console.log` the returned result
- [ ] Display the detailed movie result in the in the details view you created earlier
diff --git a/index.html b/index.html
index 34e70802..feb71fd7 100644
--- a/index.html
+++ b/index.html
@@ -14,8 +14,18 @@
-