zoukankan      html  css  js  c++  java
  • JSONP是什么

    JSONP(JSON with padding):」

    1. JSONP是通过 script 标签加载数据的方式去获取数据当做 JS 代码来执行

    2. 提前在页面上声明一个函数,函数名通过接口传参的方式传给后台,后台解析到函数名后在原始数据上「包裹」这个函数名,发送给前端。换句话说,JSONP 需要对应接口的后端的配合才能实现。

    When you place an AJAX request, you also pass in a parameter that mentions the name of a callback function.

    The code on the server is designed to return back the json response wrapped inside a function code.

    By wrapping the response JSON in a function call, the same origin policy is bypassed, allowing cross domain data interchange.

    Inplementing this requires a little extra effort, At both the frontend and the backend.

    (为了便于客户端使用数据,逐渐形成了一种非正式传输协议,人们把它称作JSONP,该协议的一个要点就是允许用户传递一个callback参数给服务端,然后服务端返回数据时会将这个callback参数作为函数名来包裹住JSON数据,这样客户端就可以随意定制自己的函数来自动处理返回数据了)。

  • 相关阅读:
    css3 实现水平或垂直布局
    css div 细边框
    css scroll bug
    F和弦大横按
    简单分析beyond作曲
    [编织消息框架][设计协议]优化long,int转换
    nginx 限制ip
    nginx注册成服务
    nginx 添加win 服务
    sqlserver 使用维护计划备份
  • 原文地址:https://www.cnblogs.com/guojunru/p/5459827.html
Copyright © 2011-2022 走看看