我有一个简单的脚本:
$.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
相同?