EricFr8
11-01-2006, 11:48 PM
1) Script Title: ajaxroutine.js
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxroutine.htm
3) Describe problem:
I'm trying to use the ajaxpack.js but running into a problem:
The code is exceedingly simple, taken right from the page:
<script type="text/javascript" src="ajaxroutine.js"></script>
</HEAD>
<BODY>
<div id="test"></div>
<script type="text/javascript">
function processGetPost()
{
var myajax=ajaxpack.ajaxobj;
var myfiletype=ajaxpack.filetype;
if (myajax.readyState == 4)
{
if (myajax.status==200 || window.location.href.indexOf("http")==-1)
{
if (myfiletype=="txt")
{
var target = document.getElementById("test");
target.innerHTML=myajax.responseText;
alert(myajax.responseText);
}
else alert("xml" + myajax.responseXML);
}
}
}
ajaxpack.getAjaxRequest("frames.php", "frameName=frame001", processGetPost, "txt");
</script>
Here is my frames.php:
<?php
$frame = $_GET['frameName'];
echo $frame;
?>
The responseText alert shows the complete text of frames.php, not "frame001" as I hoped. I've fooled with it for a couple hours and am frustrated.
I installed Xampp on a Windows XP laptop, which seems to be working fine.
What little gotcha have I missed?
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxroutine.htm
3) Describe problem:
I'm trying to use the ajaxpack.js but running into a problem:
The code is exceedingly simple, taken right from the page:
<script type="text/javascript" src="ajaxroutine.js"></script>
</HEAD>
<BODY>
<div id="test"></div>
<script type="text/javascript">
function processGetPost()
{
var myajax=ajaxpack.ajaxobj;
var myfiletype=ajaxpack.filetype;
if (myajax.readyState == 4)
{
if (myajax.status==200 || window.location.href.indexOf("http")==-1)
{
if (myfiletype=="txt")
{
var target = document.getElementById("test");
target.innerHTML=myajax.responseText;
alert(myajax.responseText);
}
else alert("xml" + myajax.responseXML);
}
}
}
ajaxpack.getAjaxRequest("frames.php", "frameName=frame001", processGetPost, "txt");
</script>
Here is my frames.php:
<?php
$frame = $_GET['frameName'];
echo $frame;
?>
The responseText alert shows the complete text of frames.php, not "frame001" as I hoped. I've fooled with it for a couple hours and am frustrated.
I installed Xampp on a Windows XP laptop, which seems to be working fine.
What little gotcha have I missed?