Obtaining JSON data from a URL that provides a .txt file

I am facing an issue with retrieving JSON data from a URL

For example, here is the URL:

This URL provides a .txt file which contains JSON data

I am unsure how to extract the JSON data from the .txt file in order to display it on a page

Any assistance would be greatly appreciated :)

Answer №1

The information is structured in JSONP form, which means JSON data enclosed within a callback function.

For more details, visit: https://developers.google.com/books/

$.ajax({
  url: "https://books.google.com/books?bibkeys=ISBN:1118691784,OCLC:879947237,LCCN:&jscmd=viewapi",
  dataType: "jsonp",
  jsonpCallback: "updateGBSCover"
});

function updateGBSCover(data) {
  // console.log(data);
  $("#result").append($('<img/>',{"src": data["OCLC:879947237"].thumbnail_url}));
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div id="result"></div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Looking for a dropdownlist with checkboxes in asp.net mvc but without the use of Entity Framework

I am in need of a dropdown list with checkboxes in asp.net mvc. The issue is that my view already has a layout page with existing script files, which seem to be causing a disturbance in the original layout. I have tried various solutions such as rearrangi ...

before sending the url with fetch(url), it is adjusted

My front end code is currently fetching a URL from a local node.js server using the following snippet: fetch('http://localhost:3000/search/house') .then(.... Upon checking what is being sent to the server (via the network tab in Firefox dev ...

Expo + tRPC: Oops! Looks like the application context couldn't be retrieved. Don't forget to wrap your App inside the `withTRPC` HoC for

I'm currently working on a straightforward tRPC server setup: // server.ts import { initTRPC } from "@trpc/server"; import { z } from "zod"; const t = initTRPC.create(); export const appRouter = t.router({ greeting: t.procedu ...

Sending the id as a prop in react-router-dom

Is it possible to pass an ID in props to a React component using react-router-dom? Take a look at my app.js file below: <Switch location={this.props.location}> <Route exact path="/" component={Home} /> <Route path= ...

Unable to submit /api/sentiment

I'm currently troubleshooting the /api/sentiment endpoint in postman and encountering a "cannot POST" error. I have confirmed that the routes are correct and the server is actively listening on port 8080. Interestingly, all other endpoints function wi ...

"Utilize jQuery to create a new row when an image button is clicked

I am looking for a way to duplicate the existing <tr> every time I click on the + button, represented by <i class="fa fa-plus" aria-hidden="true"></i> Here is the structure of my <tr>. How can I achieve this using jQuery or JavaScr ...

How to properly pass scope in a directive's template within AngularJS

Can anyone assist me with setting up a directive and printing its scope? I am encountering an error. //module declaration var app = angular.module('myApp',[]); //controller declaration app.controller(function($scope){ $scope.name = "Joseph"; ...

bento-ng-d3 is missing from the npm registry, along with other bento packages, including Angular

I have encountered a dependency in my Angular project's package.json file that includes the following: "@bento/bento-ng":"8.4.1", "@bento/bento-ng-d3":8.4.1, "@bento/bento-ng-datamap":8.4.1, "@bento/bento-n ...

Create a feature in three.js that allows users to click on an object to display information about the

After loading an object using the GLTF loader into my scene, I want to create a point on this object to display popup info. Is there a way to add a point to a specific location on the object? ...

Contrast the table column to a JSON object and modify a different column in an HTML file

This Dashboard is my first venture into using HTML and Javascript to create an interactive display. The table within this Dashboard showcases server names, descriptions, and time-related columns for uptime, warning, and critical statuses. To generate an A ...

What is the best way to streamline this JavaScript code using function chaining?

Can you simplify these function calls by chaining them? Is there a way to combine forEach, push, array destructuring, and map? let selectorsForLoader = ['a', 'b']; let loadingElements = []; selectorsForLoader.forEach(selector => ...

Attempting to replace the checkbox image resulted in no changes

<?php require 'includes/configs.inc.php'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php $site_name ?></titl ...

The primary element in Jackson for XML and JSON files

I am working on a service that provides data in both JSON and XML formats. http://localhost:8091/apiN/xml/2 Output in XML format <restObjectList> <restObjectList> <restObjectList> <timestamp>2017-06-19 17: ...

Utilizing Next.js to create dynamic routes and static builds incorporating unique ID values within the URL paths

Is there a way to create a page in Next.js where I can extract the ID from the URL in a dynamic route and use it for a static build without having to predefine all possible values of the ID in getStaticProps()? For example, the URL is as follows: localhost ...

Issue with Readonly modifier not functioning as expected in Angular/Typescript

My goal is to create a component property that is read-only. However, I am facing an issue where the readonly modifier does not seem to have any effect. View example on stackblitz According to the documentation, once I initialize the cars property in the ...

I require a platform that can effectively store, retain, and provide access to information across various interfaces

Although it may seem like a basic issue, as someone new to Angular, I'm facing a problem. I have 2 views that both require access to the same user input data from a form. Each view has its own controller. Here's the current situation: JAVASCRIP ...

The website was accessed via HTTPS, but an insecure XMLHttpRequest endpoint from the same website was requested

My axios request below is going out over https, but I'm encountering a specific error: The page at 'http://websitename/folder1/folder2/api/atlas/home/coach' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http: ...

Is there a way to access the values that have been dynamically updated by JavaScript

Is it possible to parse an HTML page using the org.w3c.dom package? For example, let's take a look at . This webpage contains a counter that is updated by JavaScript. However, when trying to retrieve a value from: <div class='counter_field&ap ...

Creating intricate JSON arrays through PHP code

I have extracted data from the database and created a JSON file with information from two tables. The first table, semone, contains attributes such as id, semester, and course name (cname) while the second table, courses, has attributes like course name (c ...

Enhance your social chat app with Nodejs Mongoose by implementing autocomplete/suggest search functionality

As I work on creating a more efficient auto suggest search bar similar to Instagram's, I am faced with the challenge of matching regex of strangers. Imagine having a million users, each with their own unique handle. I want the search functionality to ...