Javascript 我需要使用ajax调用返回整个html页面
我需要返回此页面的内容,但当我调用此函数时Javascript 我需要使用ajax调用返回整个html页面,javascript,ajax,opencalais,Javascript,Ajax,Opencalais,我需要返回此页面的内容,但当我调用此函数时 function getResult() { var url="http://service.semanticproxy.com/processurl/ftfu27m3k66dvc3r43bzfneh/html/http://www.smallbiztechnology.com/archive/2013/12/why-creating-a-digital-storefront-is-crucial-for-your-small-
function getResult() {
var url="http://service.semanticproxy.com/processurl/ftfu27m3k66dvc3r43bzfneh/html/http://www.smallbiztechnology.com/archive/2013/12/why-creating-a-digital-storefront-is-crucial-for-your-small-business.html";
$.ajax({
cache: true,
url: url,
success: function (result) {
alert(result);
}
});
}
我在firebug中得到了这个:
segment.min.js ligne 1
获得200 OK 379 mSA
知道如何获取该页面的内容吗?此代码不适用于您。原因是您试图检索的html页面不是有效的JAVASCRIPT文件,并且您也不能使用jsonp,因为它没有返回任何json字符串 您的解决方案是使用服务器脚本,如php:
<?Php print file_get_contents(url); ?>
或者-如果网站是您的,请根据请求向脚本添加响应。您遇到的是同一来源策略。研究跨域AJAX。该URL不允许来自不同域的请求,您需要在服务器上托管自己的代理脚本,以下载并返回URL的内容。