如何使jquery.get与curl相同?

时间:2019-05-07 12:08:18

标签: jquery ajax cors jqxhr

我有一个简单的脚本:

$.get("https://example.com/", function(data) {
  console.log(typeof data); // string
  console.log(data); // WHY NULL HERE ?
  // var html = $.parseHTML(data);
}).fail(function() {
  console.log("error");
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

并且使用this extension禁用了CORS。

为什么data为空?以及如何使jQuery.get()的行为与curl相同?

0 个答案:

没有答案