javascript - 跨域时出现了“Internal Server Error”问题

 艾你如斯i 发布于 2022-11-16 07:57
  1. 想用这个网站(“http://www.webxml.com.cn/zh_c...”)上的xml数据,写一个天气预报的网页

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

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

源代码

$('#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,没问题就跟后端协商下吧。

    2022-11-16 08:44 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有