I am using de api of google for books to read info about the books I call a url with ISBN number and this return a JSON I create a hash where I save the data that I want.
The next step if get this hash value to save in database.. any idea how to get this value and get out. this is my code
var id = "0716604892";
var post_url = "https://www.googleapis.com/books/v1/volumes?q=isbn:";
post_url = post_url + id;
findBook("0716604892");
function findBook(elem) {
var id, post_url, request;
post_url = "https://www.googleapis.com/books/v1/volumes?q=isbn:";
id = elem;
post_url = post_url + id;
request = function (){
$.ajax({
url: post_url,
method: 'GET',
data: {
dataType: "json"
},
success: function(html, data) {
var author, hashPetName, image, title;
title = html['items'][1]['volumeInfo']['title'];
author = html['items'][1]['volumeInfo']['authors'][0];
image = html['items'][1]['volumeInfo']['imageLinks']['smallThumbnail'];
hashPetName = {
'title': title,
'author': author,
'image': image
};
},
error: function(errorThrown) {
console.log(errorThrown);
}
});
return hasBookName
};
};
elemento_save = request;
I want that elemento_save = hasBookName