Jump to content

Ajax/PHP/VMS


Wingthor

Recommended Posts

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.

Link to comment
Share on other sites

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 :rolleyes: 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"; ?>;

Link to comment
Share on other sites

Then you understand twice as much as me :rolleyes: 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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!!! :D

Regards

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...