Need some help with responseHTML...

Archives of the forum. The responseHTML attribute and the display of text loaded.

Forum

Content not displayed

Mon, 10 Sep 2007 19:01:13

zap_xlib

I would like to know why the code below is not displaying any contents in the <textarea>... The Code:

<html>
<head>
<title>~ Used anaa framework ~</title>
</head>

<body>

<script src="anaa.js" type="text/javascript"></script>
<script type="text/javascript">
	function processHTML(temp, target) 
	{
		//target.innerHTML = temp.innerHTML;
		target.getElementsByTagName('textarea').innerHTML = temp.getElementsByTagName('table').item(0).innerHTML;
	};
	function displayHTML(url, storageID, viewedID )
	{
		var x = document.getElementById(viewedID);
		AALoadHTML(url, processHTML, storageID, x);
	};
</script>

<h1>Testing...</h1>
 
<div id="storage" style="display:none;">
</div>

<FORM name="ajax" method="POST" action="">
		
    <INPUT type="BUTTON" value="Display data from another web page"  

ONCLICK="displayHTML('Some External HTML File','storage','displayed');"><br>
<textarea rows="6" cols="40" id="comments"></textarea>
</FORM>

<div id="displayed">
</div>

</body>
</html>
I have used anaa framework to extract html content from another website. But that doesn`t work.. hope someone helps me... (I`d like to have a correct version of the code above.) Thanks.
Tue, 11 Sep 2007 12:34:57

Administrator

First of all, replace the URL by something as test2.html or any valid filename... Try the to upload the demo "demo-get-html". Do you have tested your file locally or online? The demo works only on line.
Tue, 11 Sep 2007 14:33:42

zap_xlib

Actually i`m trying it only online. This forum does not allow external links, that`s why i have put 'Some External HTML File' in the quoted code above. I want to get the contents of the body of a webpage in the text format between the text area tags.. would it be possible?...
Wed, 12 Sep 2007 18:27:25

Administrator

Yes a function of the library allows to get the whole body, then you access data with the DOM. If you have uploaded the demo on your site, temporarily and if it works, you should be able to do whatever you want with DOM and JavaScript. If it does not work, let us know.

responseHTML not displaying Javascript generated content

Fri, 06 Feb 2009 05:03:47

scripter

Hi, I came across your article "Why not responseHTML?". Its really good stuff. However I'm facing a small issue with it. The content of my "anotherpage" is generated via Javascript and its not getting displayed in the main page. I guess this is because the Javascript is not getting executed. It would have been of great help if you could help me solve this issue. Thanks in advance. scripter.
Fri, 06 Feb 2009 20:18:16

Administrator

Hello, I am afraid there is no simple solution to that, because JavaScript is executed by the browser, while the content of "anotherpage.html" is loaded directly, extracted and inserted into the current page by Ajax in our code. If you insert the JavaScript code from anotherpage into the current page, it should works. The responseHTML technique is mainly intended to have dynamic textual content parsed by search engine crawler in another static page, and things as forms, images or dynamic contents are unlikely to be retrieved by Ajax.
Forum

responseHTML.js makes the HTML loaded lowercase

Fri, 01 Feb 2008 20:09:40

booies

So I'm having a problem with the responseHTML.js and ajax.js files. I'm using them to load the content of another page into the original page. What happens is the content loads fine but all the letters that were capitals, turn to lowercase. I thought I could fix this by removing the first line of getBody (content) which is " content = content.toLowerCase(); " however it still does not work. If you look at the demo "Reading an HTML page", it also makes the capital letters in anotherpage.html lower case. Is there anyway to fix this? Also, is there any reason why I should not use this code on a site that gets a lot of traffic. I'm quite new to ajax and I'm looking for an easy way to make an ajax nav bar that does this. Thanks for all your help!
Sat, 02 Feb 2008 11:00:26

Administrator

I have uploaded a new version. Download the new responseHTML.txt file, and use the "reload" command to make sure the version in cache is not loaded again. Actually the changes in the function was submitted by a contributor to handle case sensitivity in tags, and I have not take care to the uppercase issue in the text. About your question, Google use Ajax, there is not reason to not use it on a big website. But one must avoid to fill too much content in a dynamic way as it is not indexed by search engines. responseHTML is intended to overcome the problem.
Sun, 03 Feb 2008 19:29:38

booies

Thank you very much for the reply. I do have one more question though. How would I apply this type of fast AJAX load, for a submit. So that when I hit submit, the page doesn't reload but the content of the display div changes. Thanks again.
Mon, 04 Feb 2008 19:12:08

Administrator

If you want to replace the div that contains the form by the content of another page, maybe
divid.innerHTML = content
could work? content (returned by Ajax) may be stored into another div at load.
© 2007-2013 Xul.fr