PHP interesse |
|
Heb een oplossing gevonden. Thx voor de tip
function Process(url)
{
// proceed only if the xmlHttp object isn't busy
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
{
// execute the quickstart.php page from the server
xmlHttp.open("GET", "http://mike.virtual-knowledge.be/pagescript2/PaginaScript.php?url=" + url, true);
// define the method to handle server responses
xmlHttp.onreadystatechange = handleServerResponse;
// make the server request
xmlHttp.send(null);
}
else if(xmlHttp==null){
alert ("Your browser does not support AJAX!");
return;
}
else
// if the connection is busy, try again after one second
setTimeout('Process("'+url+'")', 1000);
}
// executed automatically when a message is received from the server
function handleServerResponse()
{
// move forward only if the transaction has completed
if (xmlHttp.readyState == 4)
{
// status of 200 indicates the transaction completed successfully
if (xmlHttp.status == 200)
{
// extract the XML retrieved from the server
xmlResponse = xmlHttp.responseText;
// update the client display using the data received from the server
document.getElementById("content").innerHTML = xmlResponse;
}
// a HTTP status different than 200 signals an error
else
{
alert("There was a problem accessing the server: " + xmlHttp.statusText);
}
}
}
function Process(url) { // proceed only if the xmlHttp object isn't busy if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) { // execute the quickstart.php page from the server xmlHttp.open("GET", "http://mike.virtual-knowledge.be/pagescript2/PaginaScript.php?url=" + url, true); // define the method to handle server responses xmlHttp.onreadystatechange = handleServerResponse; // make the server request xmlHttp.send(null); } else if(xmlHttp==null){ alert ("Your browser does not support AJAX!"); return; } else // if the connection is busy, try again after one second setTimeout('Process("'+url+'")', 1000); } // executed automatically when a message is received from the server function handleServerResponse() { // move forward only if the transaction has completed if (xmlHttp.readyState == 4) { // status of 200 indicates the transaction completed successfully if (xmlHttp.status == 200) { // extract the XML retrieved from the server xmlResponse = xmlHttp.responseText; // update the client display using the data received from the server document.getElementById("content").innerHTML = xmlResponse; } // a HTTP status different than 200 signals an error else { alert("There was a problem accessing the server: " + xmlHttp.statusText); } } }
en m'n phpscript ziet er nu zo uit
<?php
/**
* @author Maffiow
* @copyright 2008
* @title: AJAX PaginaScript V 1.0
*
* @date: 05/01/2008
*/
session_start();
$refresh = new PaginaScript();
$result = $refresh->getResults();
include($result.".php");
//class PaginaScript aanmaken
class PaginaScript {
var $url; // in php 5 kan je i.p.v var private maken
function PaginaScript() {
$this->url = $_GET['url'];
}
function getResults(){
$resultje = $this->url;
return $resultje;
}
}
?>
<?php /** * @author Maffiow * @copyright 2008 * @title: AJAX PaginaScript V 1.0 * * @date: 05/01/2008 */ $refresh = new PaginaScript(); $result = $refresh->getResults(); include($result.".php"); //class PaginaScript aanmaken class PaginaScript { var $url; // in php 5 kan je i.p.v var private maken function PaginaScript() { $this->url = $_GET['url']; } function getResults(){ $resultje = $this->url; return $resultje; } } ?>
|