I would like to ask you, how is this achieved and what is the significance?

clipboard.png

Is there any special way to write a

request for an api, but the result is in such a format?

or is it artificially constructed into this format?

What is the convenience of

?

Why not just return a json object?

also hope for advice!

Oct.22,2021

jsonp learn about


this pattern is called jsonp and is a way to use json to solve the problem of reading data across domains.

what is cross-domain?
for example, suppose I open a web page with the address www.1234.com , but I want to go to the www.3456.com address to get the data. If the current page address is not the same as the domain name from which the data is obtained, it is called cross-domain.

in order to solve the cross-domain problem, jsonp imitates the way of calling js (there is no cross-domain). The < script > tag is dynamically added to call the js script provided by the server, and then get the name of the calling method and the data it wraps. Of course, the jsonp solution is not limited to cross-domain situations, but it can also be used in the same domain, but it is not as convenient as the simple json method.

if the landlord is still confused, it is recommended to read this article to learn more

.

is artificially spelled like this, in order to solve cross-domain problems.
there is no cross-domain problem when js is introduced, and it is executed automatically after js, so the foreground defines the method, and the background dynamically generates the js, that executes this method with the data as parameters. This is called jsonp



jQuery's ajax method to set dataType: 'jsonp',. This will happen


you should first look at the relevant call request. This is the return of the JSONP call. JSONP is mainly used to solve cross-domain problems to solve some basic data services integrated into all kinds of web online systems.
its return actually includes two parts to call the function and the actual data as parameters (usually in json format), which is inserted into the program execution project in the form of js loading, so that the data can be obtained and used by the needed web program.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3aac2-2ba85.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3aac2-2ba85.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?