I am using coldfusion. I am sending a form and then after I am done sending the information, I am trying to redirect to another page. I use my ajaxmanager function to redirect but it doesn't work. It says that the ajaxmanager does not exist. It should exist because I call it in the header on each page. I even tried calling it right before I call the function.
Code:
<script language="javascript" src="../../includes/ajax/ajaxManager.js" type="text/javascript"></script>
Here is the ajaxmanager function
Code:
/*
*Written by Josh Smith and Tony Trupe. Effects added by Jeff Pamer.
* args[0] is the action, can be load_page only atm
* args[1] is the src url, ie the url you have crafted and want to be passed to apache/cf
* args[2] is the dest element, ie a div named 'main', et.c.
* args[3] is the effect string, ie an effect name
*/
function ajaxManager()
{
//just creating an alias to the anonymous arguements being passed in
var args = ajaxManager.arguments;
//switch over the effect string
switch (args[3])
{
case "fade":
new Effect.Opacity(args[2],
{ duration: 0.3,
transition: Effect.Transitions.linear,
from: 1.0, to: 0.1, afterFinish: function(){ ajaxManager(args[0],args[1],args[2],"fadein") }});
break;
default:
//switch over the action
switch (args[0])
{
//if the first arg is 'load_page', then do this stuff
case "load_page":
//try to use an activeXObject::XMLHTTP, if that fails, use an XMLHTTPRequest object
var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
//if we got some form of and http object...
if (x)
{
//set a call back function for when the readystate changes
x.onreadystatechange = function()
{
//if the readystate is not 4, then display the loading icon
if(x.readyState != 4)
{
//request is not complete yet
el = document.getElementById(args[2]);
el.innerHTML = "<img src='/wwwadmin/includes/ajax/images/loading_circle.gif' alt='Loading'>";
}
//if the readystate is 4(which is the last state), and the status is 200, then we finished the request
else
if (x.readyState == 4)
if(x.status == 200)
{
//get the destination element, id is in args[2]
el = document.getElementById(args[2]);
//and replace the innerHTML with the response text, removing some whitespace
el.innerHTML = x.responseText.replace(/(^\s+|\s+$)/g,'');
if (args[3] == "fadein")
{
new Effect.Opacity(args[2],
{ duration: 0.5,
transition: Effect.Transitions.linear,
from: 0.0, to: 1.0 });
}
}
else
{
//request failed
el = document.getElementById(args[2]);
el.innerHTML = "";
//an error was encountered
alert("There was a problem retrieving the XML data:\n"+x.statusText);
}
}
//open the http request object
x.open("GET", args[1], true);
//send the http request
x.send(null);
}
break;
}
}
}
This is the script for the redirect
Code:
<script type='text/javascript'>ajaxManager('load_page', 'wiki/ajax_wiki_main.cfm?action=wiki_view_topic&proj_id=#selectApp.related_app#&expand=#form.topic_num#', 'wiki-body-inner', 'fade');</script>
Could anyone give me some insight into this.