Jump to content

[SOLVED] Load Page - New Script


lilman

Recommended Posts

I am completely stumped at this point.  I am using IE 7 to test out my code which is below:

<script>
function statusEnableDisable(page,usediv, form) 
{
// Set up request varible
try {
	xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
}  
catch (e) { 
	alert("Error: Could not load page.");
}

if(form == "photoalbum"){
	var object = document.getElementById('photoalbum').selectedIndex;

	if(object == "1"){
	status = "Enabled";
	}
	else if(object == "2"){
		status = "Disabled";
	}	
}
else if(form == "file"){
	var object = document.getElementById('filestorage').selectedIndex;

	if(object == "1"){
	status = "Enabled";
	}
	else if(object == "2"){
		status = "Disabled";
	}	
}

page = page + "status=" + status;
page = page + "&form=" + form;
alert(page);

//Show page is loading
document.getElementById(usediv).innerHTML = 'Loading Page...';

//scroll to top
scroll(0,0);

//send data
xmlhttp.onreadystatechange = function(){
	//Check page is completed and there were no problems.
	if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
		//Write data returned to page
		document.getElementById(usediv).innerHTML = xmlhttp.responseText;
	}
}

xmlhttp.open("GET", page);
xmlhttp.send(null);

//Stop any link loading normaly
return false;
}
</script>

 

The variable page alerts me of the correct URL which is: php/updateEnableDisable.php?status=Disabled&form=file or form equals photoalbum

 

Can anyone spot out why this will not work, it doesn't load the page (updateEnableDisable.php)

Link to comment
https://forums.phpfreaks.com/topic/63356-solved-load-page-new-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.