码迷,mamicode.com
首页 > Web开发 > 详细

JSONP基础知识

时间:2016-05-04 22:47:14      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:

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数据,这样客户端就可以随意定制自己的函数来自动处理返回数据了

JSONP基础知识

标签:

原文地址:http://www.cnblogs.com/guojunru/p/5459827.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!