大力出逗比

jsonP调用 跨域
jsonp格式callback({"say":"人类是无论如何都不会互相理解的愚蠢生物。","cat":"a","...
扫描右侧二维码阅读全文
12
2016/08

jsonP调用 跨域

jsonp格式

callback({"say":"人类是无论如何都不会互相理解的愚蠢生物。","cat":"a","catname":"动画","source":"火影忍者","id":"530"})


<script type="text/javascript" src="jquery.js"></script>
<script>
  function getsay() {
  $.ajax({
            url: "http://blog.1a2b.xyz/say.php?encode=jsonp",
            dataType: "jsonp",
            async: true,
        jsonp: "callback",
        jsonpCallback: "callback",
            success: function(result) {
    $('.say').html("<p>" + result.say + "=="+result.source + "</p>")
            },
            error: function() {
    $('.say').html("<p>读取失败</p>")
            }
             });
   }
getsay();
</script>
<div class="say"></div>

Last modification:January 1st, 1970 at 08:00 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment