Skip to content

Commit

Permalink
storing values on submit
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangrunest committed May 24, 2019
1 parent 0d6c480 commit 21fce5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
29 changes: 19 additions & 10 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@ if ( localStorage.getItem('term') != null ) {
});
}

$('#srch-submit').on('click', () => {
event.preventDefault();
const category = $('#srch-category').val();
const criteria = $('#srch-criteria').val();
});



// $(document).on('click', 'button', () => {

$(document).on('click', 'button', () => {
localStorage.setItem('term', event.target.id);

// localStorage.setItem('term', event.target.id);
// alert(event.target.id);
$.ajax({
method: 'GET',
url: '/scrape/' + event.target.id
})
.then(data => {
window.location.reload();
})
})
// $.ajax({
// method: 'GET',
// url: '/scrape/' + event.target.id
// })
// .then(data => {
// window.location.reload();
// })
// })


// Whenever someone clicks a p tag
Expand Down
6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@
<h4 class="is-underlined text-center">Search Criteria</h4>
<div class="row">
<div class="col-12 col-md-4 text-left mt-4">
<select class="form-control form-control-md">
<select class="form-control form-control-md" id="srch-category">
<option>Category</option>
<option>Motorcycles</option>
<option>Furniture</option>
<option>Musical Instruments</option>
</select>
</div>
<div class="col-12 col-md-4 mt-4">
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
<input type="text" class="form-control" id="srch-criteria" placeholder="Search Criteria">
</div>
<div class="col-12 col-md-4 mt-4">
<button type="submit" class="btn btn-primary">Submit</button>
<button id="srch-submit" type="submit" class="btn btn-primary">Submit</button>
</div>
</div>

Expand Down

0 comments on commit 21fce5b

Please sign in to comment.