javascript - 跨域时出现了“Internal Server Error”问题
迷茫
迷茫 2017-04-11 09:03:33
[JavaScript讨论组]
  1. 想用这个网站(“http://www.webxml.com.cn/zh_c...”)上的xml数据,写一个天气预报的网页

  2. 用的jq的ajax方法,使用了这个cors(“https://crossorigin.me/”)跨域网址

  3. 运行代码后出现的错误

源代码

<input type="button" id="testing" value="测试" />
$('#testing').click(function () {
            var cors="https://crossorigin.me/";
            var urlWeather="http://ws.webxml.com.cn/WebServices/WeatherWS.asmx/getWeather?theCityCode=486&theUserID=";
            $.ajax({
                url:cors+urlWeather+"",
                type:"GET",
                success:function (text,status,xhr) {
                    console.log(text+'\n'+status+'\n'+xhr);
                },
                error:function (xhr,status,error) {
                    console.log(xhr+'\n'+status+'\n'+error);
                    console.log(xhr);
                },
            });
        });
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

全部回复(1)
伊谢尔伦

这应该是一个后台错误,当然不排除是因为前端调用参数不正确引发的(虽然理论上不这种情况不应该引发后端直接抛出异常),检查一下 API,没问题就跟后端协商下吧。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号