Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1930 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Other Programming Languages :

ajax question

Thread title: ajax question
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
09-11-2007, 03:18 AM
#1
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old  ajax question

How do I get multi-line data from the Request.responseText element of th DOM? I have a basic ajax script where I need to return an entire page of data.

Here is the code
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
	<script src="javascripts/prototype.js" type="text/javascript"></script>
	<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Title Here</title>
</head>
<body>
<script language="javascript" type="text/javascript">
<!-- 
function reset(){
	new Effect.SwitchOff("result");
}
function GetRSS(){
	var Request;
	
	try{
		// Opera 8.0+, Firefox, Safari
		Request = new XMLHttpRequest();
	} 
	catch (err)
	{
		// Internet Explorer Browsers
		try
		{
			Request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (err) 
		{
			try
			{
				Request = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (err)
			{
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	
	// Create a function that will receive data sent from the server
	Request.onreadystatechange = function(){
		
		if(Request.readyState == 4){
			document.getElementById("result").innerHTML = Request.responseText;
		}
		
	}
	Request.open('POST', "functions/rss.php", true);
	Request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	Request.send("url=http://www.youngbutstrong.com/feed" );
}

//-->
</script>


<a href="" onclick="GetRSS(); return false;">Click me</a>
<div id="result"  onclick="reset();">&nbsp;</p>
</body>
</html>

     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed