0

I am using following code to display the contents of one of a remote website using Jquery/Ajax.
The code works great, the problem is when i do View-Source in Browser the actual contents are not diplayed. Just the Jquery code is displayed. So what i want to do is When i View-source in browser the actual content should be displayed as well keeping SEO in mind.

Is this possible ?

<script type="text/javascript" language="javascript">
    $(document).ready(function() {
        var directoryName = 'anthropology';
        $.ajax({
            type: 'GET',
            url: "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fd4426411.u92.gohsphere.com%2F%22%20and%20xpath%3D%22%2F%2Fdiv%5B%40id%3D'page'%5D%22",
            dataType: 'html',
            success: function(data) {
                $(data).find('a').attr('href', function(_, href) {
                return href.replace('http://d4426411.u92.gohsphere.com/', 'http://www.abc.com/blog/default.htm/')
                }).end().appendTo('#content_area');                     
            }
        });
    });
</script>


</head>

<body>
<div id="space"><br /></div>
<div id="content_area">
</div>
gdoron
  • 147,333
  • 58
  • 291
  • 367
user580950
  • 3,558
  • 12
  • 49
  • 94
  • On which browser you are testing this?? – Aditya Singh Apr 07 '13 at 15:08
  • 1
    @wizkid, I believe it's the same behavior in all of them. – gdoron Apr 07 '13 at 15:09
  • @gdoron If you are using IE7/8, so the browser html doesn't refreshes itself in case dynamic html change, you need explicit refresh html content inside developer toolbar which is not the case with other browers(Chrome,FF) – Aditya Singh Apr 07 '13 at 15:11
  • FireFox i am testing I am not asking to change the Browser what i want to do is show the actual contents in Output (in Html codeE whatever that has been read ) – user580950 Apr 07 '13 at 15:14
  • Possible duplicate of http://stackoverflow.com/questions/9654737/content-of-html-page-changed-by-jquery-but-view-source-dont-reflect-the-chang – Aditya Singh Apr 07 '13 at 15:27

0 Answers0