• angular框架下的跨域问题(获取天气数据)


    1、新浪天气:http://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&day=0&city=&dfc=1&charset=utf-8

    2、中国天气网:1)http://www.weather.com.cn/data/sk/101010100.html  2)http://www.weather.com.cn/data/cityinfo/101010100.html

    3、中国万年历:1)http://wthrcdn.etouch.cn/weather_mini?city=北京  2)http://wthrcdn.etouch.cn/weather_mini?citykey=101010100

    4、和风天气(天气服务1天免费试用,城市查询服务免费,不推荐使用)

    var key='';//自行输入获取的key
    $.getJSON('https://free-api.heweather.com/v5/now?city=苏州&key='+key,function (data) { })

    5、心知天气

    官方链接:https://github.com/seniverse/seniverse-api-demos/blob/master/javascript/jsonp.html

    参考链接:http://www.jianshu.com/p/fa6e5eb6ba86

    6、百度API

              var type='jsonp';
                    var ak='';//自行输入百度获取的ak
                    var url='http://api.map.baidu.com/location/ip?callback=JSON_CALLBACK';
    
                    //通过IP获取当前地理位置
                    $http({
                        method: type, // 支持jsonp,
                        url: url,
                        params: { // 请求的参数
                            ak: ak
                        },
                    }).success(function (locationData) {
    
                        
                    })
  • 相关阅读:
    cstc2018 混合果汁
    CF1086E Beautiful Matrix
    AT2000 Leftmost Ball
    CF1208E Let Them Slide
    CF1208D Restore Permutation
    【置顶】博客公告
    [NOI2015]软件包管理器
    【noip2018】积木大赛
    几天连测总结
    【ZJOI2007】棋盘制作
  • 原文地址:https://www.cnblogs.com/webgiser/p/7587228.html
Copyright © 2020-2023  润新知