Click here to Skip to main content
15,921,716 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: asp forum software Pin
James Brown11-Sep-05 21:41
James Brown11-Sep-05 21:41 
GeneralRe: asp forum software Pin
Vasudevan Deepak Kumar14-Sep-05 19:21
Vasudevan Deepak Kumar14-Sep-05 19:21 
Questionphp (help please!) Pin
Sam 200610-Sep-05 10:23
Sam 200610-Sep-05 10:23 
AnswerRe: php (help please!) Pin
Expert Coming10-Sep-05 18:45
Expert Coming10-Sep-05 18:45 
AnswerRe: php (help please!) Pin
hiral_shah9-Mar-07 19:52
hiral_shah9-Mar-07 19:52 
QuestionView State Pin
reza toorani9-Sep-05 20:13
reza toorani9-Sep-05 20:13 
AnswerRe: View State Pin
enjoycrack9-Sep-05 20:17
enjoycrack9-Sep-05 20:17 
Questionweird javascript error Pin
Anonymous9-Sep-05 3:06
Anonymous9-Sep-05 3:06 
I am trying to check whether or not a server is operating properly before I redirect my users to a login page on that server. I use the code below. When I run the following code from a saved version on my desktop (i.e. C:/Desktop/test.html) it will display my alerts and then take me to the desired location. When I upload the code to my website and then run it (via www.mysite.com/test.html) it doesn't work. It never gets passed my checkStatus alert. Does anyone have any idea why this is happening? Why does it work locally but not on my website?

Thanks in advance

P.S. I am new to javascript; a friend of mine helped me with this code.

<html>
<body>
<h1> Please Wait...</h1>
</body>
<script language="javascript">
<!--
var pollInterval = 1000;
var error_url= "error_page.html";
var checkStatusUrl = "http://server_to_be_checked.com/login.php";
var req;

// check whether you body index page is up running
// this tells the wait page to check the status every so often
window.setInterval("checkStatus()", pollInterval);

//checkStatus();
function checkStatus()
{
alert("checkStatus");
createRequester();
if(req != null)
{
req.onreadystatechange = process;
req.open("GET", checkStatusUrl, true);
req.send(null);
}
}
function process()
{
alert("process");
alert(req.readyState);
if(req.readyState == 4)
{
// only if "OK"
if (req.status == 200)
{
if(req.responseText != "")
{
// a "1" means it is done, so here is where you redirect
// to the confirmation page
document.location.replace("http://server_to_be_checked.com/login.php");
}
// NOTE: any status other than 200 or any response other than
// "1" require no action
}
}
}


/*
Note that this tries several methods of creating the XmlHttpRequest object,
depending on the browser in use. Also note that as of this writing, the
Opera browser does not support the XmlHttpRequest.
*/
function createRequester()
{
try
{
// it went to here !!!!!!
req = new ActiveXObject("Msxml2.XMLHTTP");
//alert ( "Msxml2.XMLHTTP" );
}
catch(e)
{
try
{
req = new ActiveXObject("Microsoft.XMLHTTP");
//alert ( "Microsoft.XMLHTTP" );
}
catch(oc)
{
req = null;
}
}

if(!req && typeof XMLHttpRequest != "undefined")
{
// did not go to here
req = new XMLHttpRequest();
}
//alert ( req == null);
return req;
}
//-->
</script>
</html>
Question[Message Deleted] Pin
AfzalHassen9-Sep-05 0:37
AfzalHassen9-Sep-05 0:37 
AnswerRe: how do I use JScript to move one or more items from one Listbox to another Pin
enjoycrack9-Sep-05 1:13
enjoycrack9-Sep-05 1:13 
Questionwikimedia Pin
Member 22525128-Sep-05 21:01
Member 22525128-Sep-05 21:01 
Questionhosting child web sites Pin
smita_roy8-Sep-05 20:12
smita_roy8-Sep-05 20:12 
AnswerRe: hosting child web sites Pin
Alsvha8-Sep-05 23:05
Alsvha8-Sep-05 23:05 
QuestionJavascript &amp; IE Pin
hung_ngole8-Sep-05 17:56
hung_ngole8-Sep-05 17:56 
AnswerRe: Javascript &amp; IE Pin
minhpc_bk8-Sep-05 18:31
minhpc_bk8-Sep-05 18:31 
GeneralRe: Javascript &amp; IE Pin
hung_ngole8-Sep-05 19:37
hung_ngole8-Sep-05 19:37 
GeneralRe: Javascript &amp; IE Pin
minhpc_bk8-Sep-05 19:54
minhpc_bk8-Sep-05 19:54 
GeneralRe: Javascript &amp; IE Pin
hung_ngole8-Sep-05 20:14
hung_ngole8-Sep-05 20:14 
AnswerRe: Javascript & IE Pin
Guffa8-Sep-05 23:37
Guffa8-Sep-05 23:37 
GeneralRe: Javascript &amp; IE Pin
Anonymous9-Sep-05 4:53
Anonymous9-Sep-05 4:53 
AnswerRe: Javascript &amp; IE Pin
Shog99-Sep-05 15:14
sitebuilderShog99-Sep-05 15:14 
GeneralRe: Javascript &amp; IE Pin
Anonymous9-Sep-05 18:11
Anonymous9-Sep-05 18:11 
GeneralRe: Javascript & IE Pin
enjoycrack9-Sep-05 18:58
enjoycrack9-Sep-05 18:58 
Questionhtml -&gt;JSTL Pin
ginognaus8-Sep-05 15:14
ginognaus8-Sep-05 15:14 
QuestionFrames etc. Pin
Jeeves1238-Sep-05 14:52
Jeeves1238-Sep-05 14:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.