Je débute en PHP et je suis en train de m'exercer à l'utilisation de NAJAX ou (XOAD), framework AJAX pour PHP.
J'ai mon fichier example.php qui me renvoie une réponse NAJAX. Lorsque je l'exécute tout seul en tapant http://localhost/example.php, il s'exécute très bien sous Internet Explorer.
Mais, lorsque, j'appelle le fichier example.php dans mon projet en faisant
Code : Tout sélectionner
include_once($GLOBALS["DOCUMENT_ROOT"].'/example.php');Voici le code de mon fichier example.php
Code : Tout sélectionner
<?php define('XOAD_BASE', $GLOBALS["DOCUMENT_ROOT"].'/xoad-0.6.0.0'); require_once($GLOBALS["DOCUMENT_ROOT"].'/myClass.class.php'); require_once($GLOBALS["DOCUMENT_ROOT"].'/xoad-0.6.0.0/xoad.php'); XOAD_Server::allowClasses('myClass'); if (XOAD_Server::runServer()) { exit; } ?> <?= XOAD_Utilities::header($GLOBALS["DOCUMENT_ROOT"].'/xoad-0.6.0.0') ?> <script language="javascript" type="text/javascript"> var myobj = <?= XOAD_Client::register(new myClass()) ?>; var mystring = 'My XOAD Application'; myobj.onStLengthError = function(error) { alert(error.message); return true; } myobj.stLength(mystring, function(result) { document.write('String: ' + mystring + '<br />Length: ' + result); }); </script>
Code : Tout sélectionner
<?php
class myClass {
function stLength($mystring) {
return strlen($mystring);
}
function xoadGetMeta() {
XOAD_Client::mapMethods($this, array('stLength'));
XOAD_Client::publicMethods($this, array('stLength'));
}
}
?>Merci de m'aider