PDA

View Full Version : Using ajaxpack and PHP return php content only



EricFr8
11-01-2006, 07:52 PM
Hi:

I'm trying to use the ajaxpack.js provided by Dynamic Drive at ajaxroutine.htm.

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?

tech_support
11-01-2006, 09:43 PM
Warning: Please post all Dynamic Drive Script Related Questions here (http://www.dynamicdrive.com/forums/forumdisplay.php?f=2)