Hello I want to include remote php scripts with JS (because not all sites have php built in) I use document.write('<img src=www.xxx.com/do.php?bla>') etc. But sometimes i do not want to output images and still need to include remote php files. How can i do this (for ex: plain or formatted text/html output) for a remote php file? Thanks
There are two possible solutions. Probably the easiest is frames, whereby the various sections of the site can come from different places. I have played around with this, even using CGI scripts to generate output <iframe width="100%" scrolling="no" src="http://www.SOMEWHERE.com/showcontent.php"> </iframe> The other thought I have is to call a php scipt as if it were external javascript and have it write its output in javascript.
For the second option, lets say i call a x.php file as Javascript, how could be mysql queries sent from it. I can understand values can be printed with document.write however what about functions?
This seems a strange way to do things. What exactly are you trying to build? Can you use AJAX? or just pull in a remote js file using <script> tags. The js file can be generated with php/mysql on the other site.
Is this for an open source project? Otherwise, I can't see why you would be trying this? As mad4 hinted, Ajax is the best bet for what you are trying to do (as long as I am understanding you correctly).
<script src="http://www.yoursite.com/?bla=0&bla=1&bla2=2"></script> Just use parameters to send details to your server
Its not something strange. Every server does not support PHP codes that my system needs to be linked to