Have ISBN Search populate the fields on the webrequest form
The old GIST webpages for ILLiad had a function that allowed a patron to enter an ISBN into a search box on the webrequest form, search for the item, and have it populate the title, author, etc.
-
Mark Sullivan commented
This script can be added at the bottom of the LoanRequest.html file.
<script>
$(document).ready(function () {
$("#search").click(function () {
var isbn = $("#isbn").val().trim();
if (isbn === "") {
alert("Please enter an ISBN.");
return;
}var apiUrl = "https://www.googleapis.com/books/v1/volumes?q=isbn:" + isbn;
$.getJSON(apiUrl, function (data) {
if (!data.items || data.items.length === 0) {
alert("No book found for this ISBN.");
return;
}var book = data.items[0].volumeInfo;
// Extract the first available ISBN (either 10 or 13)
var foundISBN = "N/A";
if (book.industryIdentifiers) {
var isbnList = book.industryIdentifiers.map(id => id.identifier);
foundISBN = isbnList.join(" "); // Include all ISBNs if available
}
$("#LoanTitle").val(book.title || "");
$("#LoanAuthor").val(book.authors ? book.authors.join(", ") : "");
$("#LoanPublisher").val(book.publisher || "");
$("#LoanDate").val(book.publishedDate || "");
$("#ISSN").val(isbn); //Change isbn to foundISBN if you want a list populating the ILLiad ISSN field
$("#LoanEdition").val(book.contentVersion || ""); // Google Books doesn't always provide a formal edition
$("#LoanPlace").val("N/A"); // Place of publication is generally not available in Google Books API
}).fail(function () {
alert("Error fetching data. Please try again.");
});
});
});
</script> -
amunds commented
Could this work like the DOI or PMID resolver? We've recently added those to our webpages and the feedback has been positive.