Ajax/PHP/VMS

I am building a module for PHPVms which I wan’t to be AJAX driven. When passing an URL through the to the PHPVms website by a XMLHttpRequest, I want my module’s public function to ‘echo’ a variable to the Javascript. But phpvms send all the headers and the whole site again, even if the modules function only echoes out a variable. Is there a way to prevent phpvms to resend the whole page?

I am using the open method with GET, url and async = true. And I am receiving responseText, which I only wan’t to be an variable used in an innerHTML tag. The PHP function is just echo “blah blah blal”;

Can anyone help me with this?

Regards.

Wingthor.

Uh, don’t understand half of what you said, but I’m guessing the gist of it is you want to just show the page rather than the headers etc.

Solution: action.php

Uh, don’t understand half of what you said, but I’m guessing the gist of it is you want to just show the page rather than the headers etc.

Solution: action.php

Then you understand twice as much as me You must understand AJAX to understand.

As we speak I have tried an other method which seems to give med the same result:

document.getElementById("main_time").innerHTML = <?php $SITE_URL . "/mymodule/getGmt"; ?>;

Then you understand twice as much as me You must understand AJAX to understand.

As we speak I have tried an other method which seems to give med the same result:

document.getElementById(“main_time”).innerHTML = <?php $SITE_URL . "/mymodule/getGmt"; ?>;

Seems like something happens when I use URL directly to the php file. The tag returns empty. Seems like I must build an independently library file. Anyone?

You just need to add a file in, you’re calling a URL which doesn’t exist.

Like so:

document.getElementById("main_time").innerHTML = <?php $SITE_URL . "action.php/mymodule/getGmt"; ?>;

That will insert your module content into the div excluding all the layout.tpl code you would normally get.

You just need to add a file in, you’re calling a URL which doesn’t exist.

Like so:

document.getElementById(“main_time”).innerHTML = <?php $SITE_URL . "action.php/mymodule/getGmt"; ?>;

That will insert your module content into the div excluding all the layout.tpl code you would normally get.

Ok, that helped me alot. The php variant returns blank, but putting the action.php into the XMLHttpRequest.open method’s URL works perfect. Now the XMLHttpRequest responseText returns what I want and nothing more!

Thanks alot!!!

Regards