question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jsonp can't return data

See original GitHub issue

i use the jsonp methods like this:

 this.$http.jsonp("http://news-at.zhihu.com/api/4/news/latest").then(
                  (response) => {console.log(response)},
                  (response) => {alert(response.json()); }
                );

but it return error : image

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
echopicommented, Oct 26, 2016

it seems like that this http://news-at.zhihu.com/api/4/news/latest api just not support jsonp.

try this:

http://news-at.zhihu.com/api/4/news/latest?callback=abc
0reactions
benjidescommented, Nov 10, 2016

Calling the GET method and passing the JSONP callback name as a parameter seems to do the trick for me. Here is a working example:

Vue.http.get('api', {
      params: {
        callback: 'callback'
      }
    })
    .then((response) => {
      console.log(response.data)
    })

Note it does not matter the callback name as the library would parse it automatically into a JSON object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't get any data back using JSONP when making a cross ...
I have a website that I need to send a GET request to from my browser and get HTML data back. But the...
Read more >
How to Use the Fetch API (Correctly) - CODE Magazine
Navigate into the folder Samples-WebAPI and load that folder in Visual Studio Code or Visual Studio 2019. Open the appsettings.json file and ...
Read more >
jQuery.ajax() | jQuery API Documentation
The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. dataType (default: Intelligent Guess (xml, json, script, ......
Read more >
JavaScript, fetch, and JSON — Flask Documentation (2.2.x)
It is usually not a good idea to return file data in a JSON response. JSON cannot represent binary data directly, so it...
Read more >
fetch-jsonp - npm
Fetch JSONP like a boss using Fetch API. Latest version: 1.2.3, last published: 3 months ago. Start using fetch-jsonp in your project by ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found