jsonp and json What's the difference? ?json It's a file format , and jsonp It's a technical approach .

jsonp Will be considered a new cross domain technology , In fact, in essence, it has something to do with utilization src Attribute tag js There's no difference in cross domain nature .

The difference is :

In other domains , Called... Defined by this domain js Method , Call your own json Data is passed as a parameter to js Method .

Here is a simple example :

function result(data) {
alert(data['name']);
}// This is the method defined on the client side
<body>
<script type="text/javascript" src="http://other domain/javascript/jsonp.js"></script>
</body>

This is body Use in script Tag load other domains js file . And in other domains js This is the document

result({'name':'jack','sex':'man'});

This is a simple and crude jsonp.

To put it simply jsonp More articles about

  1. Simple and thorough understanding JSONP Principle and use

    Let's start with JSON The concept ,JSON Is a lightweight data transfer format , Is widely used in the present Web Application .JSON The encoding and parsing of format data are basically implemented in all mainstream languages , So now most of the front-end and back-end separation architectures use JSON Format advance ...

  2. Web APi The manual implementation of JSONP Or installation configuration Cors Cross domain ( 7、 ... and )

    Preface In principle, this section should also talk about Web API principle , At present, we have finished discussing the lower level of Web API Message processing pipeline and Web Host Boarding pipes , The next step is to touch the controller .Action Method , And filters . Model binding and so on , Think ...

  3. Web API Realization JSONP Or installation configuration Cors Cross domain

    Preface In principle, this section should also talk about Web API principle , At present, we have finished discussing the lower level of Web API Message processing pipeline and Web Host Boarding pipes , The next step is to touch the controller .Action Method , And filters . Model binding and so on , Think ...

  4. Jsonp Cross domain request instance

    About jsonp An example of , In fact, I don't know much about it , I did a little research this afternoon : Simply speaking ,jsonp It's for data transfer between two different websites , It is mainly used for js Script , Because the browser itself is forbidden to cross domain access : Native instance : ...

  5. jsonp And cors

    One . jsonp The principle of implementation is to use script Tags can capture the characteristics of different sources , To access a resource across domains . The specific actions are as follows : Create a script label , Write the request address to its src attribute , Put this script Outside the chain insert ...

  6. Share a jsonp A community in Sina caused by hijacking CSRF worm

    lately jsonp A fire , To tell you the truth, it's been spoiled , It's just that we haven't paid attention to it all the time . Just last month , I dug one because jsonp Sina caused a community CSRF, It was to prepare an article , This article will be shared later . Because Sina has ...

  7. Understand thoroughly jsonp Principle and implementation method

    One . The same-origin policy All support Javascript Most browsers use the same source policy as the security policy . Look at Baidu's explanation : The same-origin policy , It is from Netscape A well-known security policy proposed . All support now JavaScript Browse ...

  8. Universal jsonp Cross domain technology to get weather data

    1. Preface Third party data is often used in the process of website development , However, due to the limitation of homology strategy ajax Unable to send request , So there's no data available . solve ajax The cross domain problem of can use jsonp technology 2. Code <!DOCT ...

  9. JSONP Cross domain and CORS Cross domain

    What is cross-domain ? Cross domain : It means that the browser can't execute scripts of other websites , It's caused by the browser's homology strategy , It's the browser's security restrictions ! The same-origin policy The same-origin policy : domain name . agreement . All ports are the same . Browser execution JavaScript Script time , I'll check this ...

Random recommendation

  1. Unity3D in Update and Lateupdate The difference between

    Unity in Update and Lateupdate The difference between .Lateupdate and Update Every shot is executed , But the order of execution is different , Execute first Updatee And then execute lateUpdate. If you have two scripts JS1. ...

  2. Java Concurrency - synchronized keyword

    When there are multiple threads competing for shared resources , Sensitive to the order in which resources are accessed , It may cause data inconsistency . To ensure that shared resources are not accessed by multiple threads at the same time , You need to put the code competing for shared resources in a critical area , The critical section ensures that at most one thread can execute the code segment at the same time ...

  3. bit and sbit The difference between

    1.bit and sbit All are C51 Extended variable types . bit and int char Or something like that , It's just char=8 position , bit=1 It's just a bit . It's all variables , The compiler allocates addresses during compilation . Unless you specify , Otherwise, the address is random . ...

  4. C# base64 code 、 decode

    public class TransferCode { #region base-64 code . decode /// <summary> /// BASE64 code /// </summary&g ...

  5. list(zip(*querySet)) Use

    teacher_cls_list = obj.cls.all().values_list('id', 'caption') #list(zip(*list)), Take out every item in the tuple of the array , Add them together ...

  6. Golang The concurrent part of

    Processes and threads A. A process is an execution of a program in the operating system , An independent unit of the system for resource allocation and scheduling . B. A thread is an execution entity of a process , yes CPU Basic unit of dispatch and dispatch , It's a smaller, independent, basic unit than a process . C. One ...

  7. Web automation - Select the operation element 2

    Article transferred from White moon and black feather religion Python As we saw earlier, according to id.class attribute .tag name Select element . If we're going to choose Elements No, id.class attribute , At this time, we can usually go through CSS selector ...

  8. CentOS The road to explore 3--- install python3

    install Python3 executive summary ​ Generally speaking Linux All types of operating systems come with their own installation python, But the system is installed by default python All are 2.x Version of . And now the general use is python3.x edition , Compared with python2. ...

  9. 〖Linux〗Ubuntu13.10 Use virtual machine to MTK Mobile phone for line brushing

    Recently, a classmate put a MTK The phone is broken , I don't have it on my laptop WindowsXp operating system : And in the MTK In the process of brushing , The best brush system is WindowsXP3, So I want to Linux Open it directly in XP Virtual machine to brush the machine ...

  10. iOS-----MFMessageCompose and MFMailComposeViewController How to use

    MFMessageCompose and MFMailComposeViewController How to use Use MFMessageComposeViewCOntroller texting The app wants to provide its own interface for users ...