且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery的阿贾克斯函数返回一个错误

更新时间:2023-12-05 07:54:46

ShelbyZ的评论使我的解决方案:

ShelbyZ's comment led me to the solution:

浏览器拒绝执行请求时,我试图用一个绝对的URL,我不得不写为相对的。

The browser refused to execute the request when I tried using an absolute URL, i had to write it as relative.

$.ajax({
  type: "POST",
  url: "process.php",
  data: { data: mydata },
  cache: false,
  dataType: "text",
  error: function(jqXHR, textStatus, errorThrown){
        alert(jqXHR.status);
        alert(jqXHR.statusText);
        alert(jqXHR.responseText);
    },
  success: function(data){
        getContentBox().innerHTML = data;
}
});

谢谢!