Hi,
On Jul 21, 7:51 am, Nilima Chavan <[email protected]> wrote:
> I have seen v8cgi, but in that case entire html page will be written using
> javascript (For eg. response.write(' <html><body> ')) . it will be .js which
> will get loaded in the browser.
>
> But is there any way to write .html and call javascript function from html
> page. For e.g. LiveWire support <server> tag in html page which indicates
> that the code within <server></server> needs to be executed on the server
> side.
I'm not exactly sure what you're looking for (processed and sent to
browser or calling server after loading in page), so here are some
different ideas:
1. Embedded (server-side) code blocks, or...
2. Normal HTML and JS loading and then calling a server-side script
for information (commonly called AJAX).
1. How about this (pseudocode; like PHP's embedded blocks of code):
<html>
<h1>Normal Page</h1>
<?javascript
//Do something on the server...
?>
</html>
Is this vaguely similar?
2. Or perhaps this ("AJAX" for calling a server-side script):
some-page.html:
<html>
<script>
window.onload = talkToServer;
function talkToServer () {
//Use "AJAX"...
var receiveResponse = function () {
//readyState is 4 when done; status is 200 if something is found (HTTP
status codes: 404 is not found, etc.)
if ((message.readyState == 4) && (message.status == 200))
{ alert(connection.responseText); }
};
var connection = new XMLHttpRequest();
connection.open("GET", "some-serverside-script.js", true);
connection.onreadystatechange = receiveResponse;
connection.send(null);
}
</script>
</html>
What seems more like your goal?
pikpik
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users