javascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

WBOY
Release: 2016-08-25 10:37:27
Original
988 people have browsed it

**

Can anyone give me an answer? I’ve been confused for several days

**
What we are doing is ajax for express interface
ajax cross-domain jsonp is so easy to get the value, but it keeps executing error and the returned value is a bit strangejavascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

Shouldn’t the data obtained be preceded by a bunch of jquery and a bunch of callback functions? Why don’t I have this
javascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

After supporting error, what appears on the console is javascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

Original interface
javascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

In the end, is it possible that it’s a problem on the server side

Reply content:

**

Can anyone give me an answer? I’ve been confused for several days

**
What we are doing is ajax for express interface
ajax cross-domain jsonp is so easy to get the value, but it keeps executing error and the returned value is a bit strangejavascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

Shouldn’t the data obtained be preceded by a bunch of jquery and a bunch of callback functions? Why don’t I have this
javascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

After supporting error, what appears on the console is javascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

Original interface
javascript - Ajax cross-domain jsonp is easy to get the value, but it keeps executing error and the returned value is a bit strange

In the end, is it possible that it’s a problem on the server side

jsonp requires server-side support. If the server-side supports cross-domain, just use json. If cross-domain support is not supported, you need to be able to modify the server side to support jsonp. But if you can modify it to support jsonp, why not modify it to support cross-domain directly? If you can't modify it, there's nothing you can do.

The working principle of jsonp is this: when you make a request, a function name will be passed to the server, which is the random string that is not called in your debugging. Then the code returned by the server calls this function and uses the return data as the call parameters.

Looking at the debugging window, the returned data is a pure json string, so jsonp cannot be used.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!