【问题标题】:Sending request to website using Javascript使用 Javascript 向网站发送请求
【发布时间】:2023-03-14 15:04:01
【问题描述】:

我正在尝试向特定网站发送 HTTP 请求,但遇到错误:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.google.com/. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

例如,我想向 Google.com 发送请求并接收 HTML 响应。 我的代码是使用 JQUERY AJAX 编写的:

function sendRequest(URL) {
          $.ajax({
            type:'GET',
            url:URL,
            success:function(result){console.log(result);}
          });
        }

【问题讨论】:

标签: javascript jquery ajax http


【解决方案1】:
猜你喜欢
  • 2015-09-20
  • 2022-12-01
  • 2021-02-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-05
  • 2023-03-19
相关资源
最近更新 更多