**
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 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
After supporting error, what appears on the console is
Original interface
In the end, is it possible that it’s a problem on the server side
**
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 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
After supporting error, what appears on the console is
Original interface
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.