刚刚学习使用 javascript [关闭]

问题描述 投票:0回答:0

我想发出 Ajax 请求...但是我的服务器没有响应。什么问题?

$.ajax({
  type: 'GET',
  url: 'https://my_server.php',
  async: true,  beforeSend: function (xhr) {
    if (xhr && xhr.overrideMimeType) {
      xhr.overrideMimeType('application/json');
    }
  },
  success: function (response) {
    alert(response); 
  },
  error: function(request,status,errorThrown) {
    alert("Network error")        
  }
});
javascript
© www.soinside.com 2019 - 2024. All rights reserved.