Reputation: 41
i'm developing a Joomla module, and i'm testing the basic approach. I have my first file:
FILE1.php
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$AdVisualV2jMODPHP_ver='0.3.0070';
$Station_ID = $params->get('Station_ID');
$Start=0;
$Page=10;
echo 'AVVIAMO LA PROCEDURA 0.0.66 - '.$Station_ID.'<br>';
echo '<div id="TabellaEventi"></div>';
echo '<INPUT Type="BUTTON" VALUE="Avanti" ONCLICK="avanti()"> ';
echo '<INPUT Type="BUTTON" VALUE="Indietro" ONCLICK="indietro()"> ';
echo '<br>';
?>
<script>
function avanti() {
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
Esito=xmlhttp.responseText;
}
}
xmlhttp.open('GET','DisplayEvents.php',false);
xmlhttp.send();
// document.write(Esito);
document.getElementById('TabellaEventi').innerHTML='CLICCO QUESTO AVANTI';
}
function indietro() {
document.getElementById('TabellaEventi').innerHTML='Pulsante INDIETRO nella div<br>questo su due righe<br>';
}
</script>
Here there is the file DisplayEvents.php:
<?php
echo 'Da qui siamo nella routine display<br>';
echo 'Procediamo pure<br>';
?>
I've used other times this way, with XMLHttpRequest i put all the text output of the file DisplayEvents.php and I put it in the variable Evento, then I can print or do what I want. But simply does not work.
I've used this way other times in an HTML file with a PHP, this time is PHP with PHP, but i can't understand.
Where I'm wrong this time? Thank you for your help.
Upvotes: 0
Views: 143
Reputation: 14237
With the information you provided, I am curious to see if it is an issue with your path's.
Change:
xmlhttp.open('GET','DisplayEvents.php',false);
To:
xmlhttp.open('GET','/DisplayEvents.php',false);
Use Chrome's Developer Console or Firefox and FireBug and look at the response on the network tabs. This will show you the status and response codes clearly.
Also, take a look at your access_logs
and see if there are entries for the calls to the DisplayEvents.php
file.
Upvotes: 1