jsonp请求

发起一个jsonp请求javascript

<!DOCTYPE html>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
 <title>test</title>
 <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.js"></script>
  <script type="text/javascript">
  $(document).ready(function(){ 
    
  $.ajax({
    type: "get",
    async: false,
    url: "http://encounter.christmas023.space/json.php?name=mavis&age=18",
    dataType: "jsonp",
    jsonp: "callback",//传递给请求处理程序或页面的,用以得到jsonp回调函数名的参数名(通常默认为:callback)
    jsonpCallback:"message",//自定义的jsonp回调函数名称,默认为jQuery自动生成的随机函数名,也能够写"?",jQuery会自动为你处理数据
    success: function(json){
     alert('你的名字:' + json.name + ' 年龄: ' + json.age);
      
    },
    error: function(){
     alert('fail');
    }
   });
  
  });
  </script>
</head>
<body>
 
</body>
</html>

 

http://www.jb51.net/article/103960.htm    jsonp返回数据样式,请求方法php

https://blog.csdn.net/a491857321/article/details/52807532     
jsonp实现json数据跨域访问html

https://blog.csdn.net/xiangnan129/article/details/54409089    jsonp后端应该如何返回数据,前端应该如何请求前端

https://blog.csdn.net/kejmln/article/details/51350777  jsonp后端应该如何返回数据,前端应该如何请求java

https://blog.csdn.net/liuqing_1/article/details/53858447?utm_source=itdadao&utm_medium=referral   jsonp跨域请求jquery

http://www.javashuo.com/article/p-gjnaksry-em.html    前端跨域解决方案(全)ajax

相关文章
相关标签/搜索