angularui - AngularJS Jsonp跨域问题

查看:162
本文介绍了angularui - AngularJS Jsonp跨域问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>

<body>
    <div ng-app="test" ng-controller="mytest">

    </div>

    <script>
        var app = angular.module('test', []);
        app.controller('mytest', function($scope, $q, $http) {
            $http.jsonp('http://www.runoob.com/try/angularjs/data/sites.php?callback=JSON_CALLBACK').success(function(data) {
                alert(data);
            });
        });;
    </script>
</body>

</html>

请问如何解决?

解决方案

我的JSON有问题

这篇关于angularui - AngularJS Jsonp跨域问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆