更新时间:2023-01-08 16:12:41
如果您可以访问其他站点并且存在Access-Control-Allow-Origin
标头,则可以像这样使用jQuery:
If you have access to the other site and the Access-Control-Allow-Origin
header is present, then jQuery can be used like this:
$.get('https://***.com/questions').then(function (html) {
// Success response
var $mainbar = $(html).find('#mainbar');
document.write($mainbar.html());
}, function () {
// Error response
document.write('Access denied');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>