ajax跨域的解决办法

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>无标题文档</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script>
    <script type="text/javascript">
        //设置dataType为JSONP格式 
        /*
         $.ajax({ 
            url:"http://test.domain.com/do?par1=1&par2=2", 
            type:'GET', 
            dataType:'JSONP', 
            success: function(data){ 
                $('body').append( "Name: " + data ); 
            } 
         });
         */
    </script> 
</head> 
<body>  
     
</body> 
</html>

 

posted @ 2017-01-30 09:05    阅读(190)  评论(0编辑  收藏  举报