Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix task 2 #19

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@
<div class="field">
<label class="label" >Job Description</label>
<div class="control has-icons-left">
<input class="input" name="description" type="text" placeholder="Filter by title, benefits, companies, experties">
<input class="input" id="description" name="description" type="text" placeholder="Filter by title, benefits, companies, experties">
<span class="icon is-small is-left"><i class="fas fa-clipboard"></i></span>
</div>
</div>
<div class="field">
<label class="label" >Location</label>
<div class="control has-icons-left">
<input class="input" name="location" type="text" placeholder="Fiter by city, state, zip code or country">
<input class="input" id="locate" name="location" type="text" placeholder="Fiter by city, state, zip code or country">
<span class="icon is-smal is-left"><i class="fas fa-globe"></i></span>
</div>
</div>
<div class="field">
<div class="control">
<label class="checkbox has-text-weight-semibold">
<input type="checkbox" name="full_time" value="full_time">
<input type="checkbox" id="full_time" name="full_time" value="full_time">
Full time only
</label>
</div>
Expand Down Expand Up @@ -125,7 +125,8 @@ <h4><a href="https://jobs.github.com/positions/850281e8-4f0f-4952-88e4-ddf121e77
</div>
</section>

<!-- <script src="index.js"></script> -->
<script src="index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<!-- <script src="job.js"></script> -->
</body>
</html>
54 changes: 54 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
let navbtn = document.querySelector('.navbar-burger');
let navmenu = document.querySelector('.navbar-menu');

navbtn.addEventListener("click", function(){
navbtn.classList.toggle("is-active");
navmenu.classList.toggle("is-active");
})

let search = document.querySelector('.button');
search.addEventListener("click", function(e) {
e.preventDefault()
let description = document.getElementById('description').value;
let locate = document.getElementById('locate').value;
let full_time = document.getElementById('full_time').checked;

let search_url = `https://still-spire-37210.herokuapp.com/positions.json?description=${description}&location=${locate}&full_time=${full_time}`;
console.log(search_url)
fetch(search_url)
.then(res => {
return res.json();
// console.log(res.json());
})
.then(function(json) {
console.log(json)
})
})


// let url = new URL('https://jobs.github.com/positions?.json');
// let qs = new URLSearchParams();
// let description = document.getElementById('description').value
// let locate = document.getElementById('locate').value
// let full_time = document.getElementById('full_time').on
// let search = document.querySelector('.control');
// search.addEventListener("click", function() {
// qs.append('description', `${description}`);
// qs.append('location', `${locate}`);
// qs.append('full_time',`${full_time}`);
// url.search = qs;
// url.href;
// console.log(url.href)
// })

// xhr
// var xhr = new XMLHttpRequest();
// let job_arr
// xhr.open("GET", "https://still-spire-37210.herokuapp.com/positions.json");
// xhr.onload = function() {
// // if (xhr.status >= 200 && xhr.status < 400) {
// job_arr = JSON.parse(xhr.responseText);
// console.log(job_arr)
// // }
// };
// xhr.send();