JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2058
Number of posts: 5158

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to load data from multiple pages? Cross Site Scripting Posted by ColacX on 15 Sept 2009 at 9:43 PM
Hi there I have some diffrent sites that i'd like to view as one long page using javascript is there anyway to do that?

The reason is that they are related in a sense and that I can use javascript to do some counting of things that i usually do everyday aswell as a lot of other people in my school does.

I tried using AJAX but im not sure what i'm doing wrong or maybe AJAX might be restricted to one page only.

Heres some code from my FAILED ajax test.
<html>
<body>

<script language="javascript" type="text/javascript">
<!-- 
//Browser Support Code
function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('ajaxDiv');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	//var age = document.getElementById('age').value;
	//var wpm = document.getElementById('wpm').value;
	//var sex = document.getElementById('sex').value;
	//var queryString = "?age=" + age + "&wpm=" + wpm + "&sex=" + sex;
	ajaxRequest.open("GET",
        "http://schema.sys.kth.se/4DACTION/WebShowSearch/2/1-0?wv_type=5&wv_category=1154&wv_ts=20090817T162950X9217&wv_search=&wv_startWeek=934&wv_stopWeek=1002&wv_first=0&wv_addObj=&wv_delObj=&wv_obj1=26878000&wv_text=Textformat",
        true);
	ajaxRequest.send(null); 
}

//-->
</script>

<form name='myForm'>
<!--
    Max Age: <input type='text' id='age' /><br />
    Max WPM: <input type='text' id='wpm' /><br />
    Sex: <select id='sex'>
        <option value='m'>m</option>
        <option value='f'>f</option>
    </select>
-->
    <input type='button' onclick='ajaxFunction()' value='Query MySQL' />
</form>
<div id='ajaxDiv'>Your result will display here</div>
</body>
</html>


Report
Re: How to load data from multiple pages? Cross Site Scripting Posted by mac_doggie on 2 Dec 2009 at 1:40 PM
With AJAX you are restricvetd to one domain.
You can use IFrames I think and then grab the content from them with Javascript...

-mac-
mailto:mac_doggie@hotmail.com
the Netherlands...



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.