简体   繁体   English

我需要使用ajax调用返回整个html页面

[英]i need to return an entire html page using an ajax call

i need to return the content of this page 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 but when i call this function 我需要返回此页面的内容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,但是当我调用此函数时

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);
                }
            });
        }

I got this in firebug: 我在萤火虫中得到了这个:

segment.min.js (ligne 1) GET http://service.semanticproxy.com/processurl/ftfu...orefront-is-crucial-for-your-small-business.html 200 OK 379msA. segment.min.js(ligne 1)GET http://service.semanticproxy.com/processurl/ftfu...orefront-is-crucial-for-your-small-business.html 200 OK 379msA。

Any idea how i can get the content of that page? 知道我如何获取该页面的内容吗?

This code won't work for you. 此代码对您不起作用。 the reason is that the html page you are trying to retrieve is not a valid JAVASCRIPT file (and you also can't use jsonp because it is not returning any json string.) 原因是您尝试检索的html页面不是有效的JAVASCRIPT文件(并且您也不能使用jsonp,因为它没有返回任何json字符串。)

Your solution is to use a server script (such as php: 您的解决方案是使用服务器脚本(例如php:

<?Php print file_get_contents(url); ?> 

). )。

OR - if the website is yours , add a response to the script on request. 或者-如果您的网站是您的网站,请根据要求添加对脚本的响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我在ASP.NET应用程序中使用ajax调用,并且从jquery Ajax调用中获取了整个HTML页面作为响应 - I'm using ajax call in ASP.NET application and I'm getting entire HTML page as response from jquery Ajax call Wordpress Ajax调用返回HTML的整个页面 - Wordpress ajax call is returning an entire page of html WordPress的ajax调用返回整个HTML页面 - Wordpress ajax call returns entire html page 如何通过AJAX调用的成功回调替换页面的整个HTML或正文内容? - How can I replace the entire HTML of a page, or its body content, via an AJAX call's success callback? Ajax 在 WordPress 中调用返回整个 HTML 页面作为响应 - Ajax call within WordPress returning entire HTML page in response 使用AJAX从Flask渲染整个HTML页面 - Render entire HTML page from Flask using AJAX I'm using AJAX to post an object from javascript to php within the same page and I'm getting the entire html page instead of the object - I'm using AJAX to post an object from javascript to php within the same page and I'm getting the entire html page instead of the object 用于页面的HTML Selectbox值ajax调用 - HTML Selectbox value ajax call using for page Spring MVC,Thymleaf在ajax调用上返回新的HTML页面 - Spring MVC, Thymleaf on ajax call return new HTML page Laravel Ajax 调用整个页面 - Laravel Ajax Call through entire page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM