Dayo
09-02-2008, 09:36 PM
I have been following the example from this linked website (http://blog.paranoidferret.com/index.php/2008/06/04/simple-ajax-php-and-javascript/) and can get it to work but wondering if anyone could give me a pointer to extending it.
Essentially, I want to trap the contents of the innerHTML call and write it to my HTML so that it actually appears in the source code.
Here is a simplified illustration of what I want to achieve
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type='text/javascript' src='js_file_with_functions_from_website.js'></script>
<title>PHP AJAX Example</title>
</head>
<body>
<div id='ResponseDiv'>Text_1</div>
<script language="JavaScript" type="text/javascript">
<!--
MakeRequest();
//-->
</script>
<div id='outputDiv'>PUT_innerHTML_OUTPUT_FROM_ABOVE_HERE</div>
</body>
</html>
Thanks for your help
P.S I found this code (http://www.ajaxf1.com/tutorial/ajax-php.html?page=3) that might be closer to what I want as it seems to change stuff displayed.
Essentially, I want to trap the contents of the innerHTML call and write it to my HTML so that it actually appears in the source code.
Here is a simplified illustration of what I want to achieve
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type='text/javascript' src='js_file_with_functions_from_website.js'></script>
<title>PHP AJAX Example</title>
</head>
<body>
<div id='ResponseDiv'>Text_1</div>
<script language="JavaScript" type="text/javascript">
<!--
MakeRequest();
//-->
</script>
<div id='outputDiv'>PUT_innerHTML_OUTPUT_FROM_ABOVE_HERE</div>
</body>
</html>
Thanks for your help
P.S I found this code (http://www.ajaxf1.com/tutorial/ajax-php.html?page=3) that might be closer to what I want as it seems to change stuff displayed.