To cut a long story short, basically, what I need to do, is submit info from a form to one location, yet have the 'thank you' page go to another location. Reason there, is that the my form submits to my CRM, and in the process, goes to a thank you page hosted by them. It takes them days to make any changes to that page, and usually they end up being wrong. Anyhow, a friend hinted at this script to get the job done, but I can't get it to work:
<script language="Javascript">
function createRequestObject() {
var http_request = true;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
http_request = false;
}
}
if (!http_request) {
//debug.append('Cannot create XMLHTTP instance');
http_request = false;
}
return http_request;
}
function sendResultsToNothing(http_request) {
var state = http_request.readyState;
var connState = ["Connection Uninitialized.","Connection Open. Wait for Request.","Data recieved.","Processing Data.","Request Complete","Unknown RPC state."];
if(state <= 4) {
switch(state) {
case 0 :
currState = connState[0];
break;
case 1 :
currState = connState[1];
break;
case 2 :
currState = connState[2];
break;
case 3 :
currState = connState[3];
break;
case 4 :
//send html to browser dom element
break;
default :
currState = connState[5];
break;
}
}
}
function main(){
var target_url = "crmsubmissionaddress";
var thankyou_url = "http://mythankyoupage.html";
var requestHandler = null;
var http_request = createRequestObject();
sendResultsToNothing(http_request); };
http_request.onreadystatechange = requestHandler;
http_request.open('GET', target_url + parameters, true);
http_request.send(null);
location.href = thankyou_url;
}
</script>
Does this look possible to anyone? Am I missing something completely? Any help would be greatly appreciated.
This post has been edited by Cruciamentum: 08 April 2008 - 02:09 PM

New Topic/Question
Reply



MultiQuote




|