我有一个HTML页面,该页面具有一个文本框,可以接受用户的输入。输入将被带到JQuery并用于搜索Google Books API,然后结果应显示在单独的页面中,但是我无法在其他页面中打印出来,该怎么做?
$(document).ready(function() {
$("#searchBookForm").submit(function(event) {
// event.preventDefault();
var search = $("#searchISBN").val();
if (search == '') {
alert("Please enter an ISBN");
} else {
$.get("https://www.googleapis.com/books/v1/volumes?q=" + search, function(response) {
console.log(response);
});
}
});
return false;
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form method="get" id="searchBookForm">
<div class="form-row justify-content-center">
<div class="col-3 col-lg-offset-4">
<input id="searchISBN" type="search" class="form-control" placeholder="Type in ISBN...">
</div>
<div class="col-2">
<button type="submit" id="submitSearch" class="btn btn-danger">Submit</button>
</div>
</div>
</form>