Benutzer:Wizard23/monobook.js: Unterschied zwischen den Versionen

aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springen
Zeile 37: Zeile 37:
 
catch (error)
 
catch (error)
 
{
 
{
                alert("eeror1");
 
 
try
 
try
 
{
 
{
Zeile 44: Zeile 43:
 
catch (error)
 
catch (error)
 
{
 
{
                        alert("error2");
 
 
requester = null;
 
requester = null;
 
 
return false;
 
return false;
 
}
 
}
Zeile 56: Zeile 53:
 
requester.send(null);
 
requester.send(null);
  
         alert("done sending request");
+
         //alert("done sending request");
 
return true;
 
return true;
 
}
 
}
Zeile 66: Zeile 63:
 
function onreadystatechange_requestLabText()
 
function onreadystatechange_requestLabText()
 
{
 
{
        alert("callback");
 
 
// If XMLHR object has finished retrieving the data
 
// If XMLHR object has finished retrieving the data
 
if (requester.readyState == 4)
 
if (requester.readyState == 4)

Version vom 9. Juli 2006, 04:34 Uhr

// taken from
// http://www.sitepoint.com/article/remote-scripting-ajax


var requester = null;
var formRequester = null;

window.onload = init;


/* Initialisation for JS capable browsers */
function init()
{
	//var cards = document.getElementById("ecardSet").getElementsByTagName("img");
	//var orderForm = document.getElementById("orderForm");
	//var receipt = document.getElementById("receipt");

        //alert("hier");
	requestLabText();

	return true;
}




function requestLabText()
{
	if (requester != null && requester.readyState != 0 && requester.readyState != 4)
	{
		requester.abort();
	}
	try
	{
		requester = new XMLHttpRequest();
	}
	catch (error)
	{
		try
		{
			requester = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (error)
		{
			requester = null;
			return false;
		}
	}

	requester.onreadystatechange = onreadystatechange_requestLabText

	requester.open("GET", "/wiki/Metalab_Wiki");
	requester.send(null);

        //alert("done sending request");
	return true;
}




/* Execute the action which has been associated with the completion of this object */
function onreadystatechange_requestLabText()
{
	// If XMLHR object has finished retrieving the data
	if (requester.readyState == 4)
	{
		// If the data was retrieved successfully
		try
		{
			if (requester.status == 200)
			{
				writeDetails();
			}
			// IE returns a status code of 0 on some occasions, so ignore this case
			else if (requester.status != 0)
			{
				alert("There was an error while retrieving the URL: " + requester.statusText);
			}
		}
		catch (error)
		{
		}
	}

	return true;
}



/* Update users details after data is retrieved via XMLHR */

function writeDetails()

{

	//var receipt = document.getElementById("receipt");



	alert(requester.responseText);
	return true;

}