Calling server side javascript function inside HTML page.

8 views
Skip to first unread message

Nilima Chavan

unread,
Jul 20, 2010, 7:15:50 AM7/20/10
to v8cgi
I am bit confuse about how to develop my own application.

Suppose I want following html page with server side javascript
function embedded into it

<html>
<body>
<!--- Here is my javascript function print the ip address -->
write(request.ip);
</body>
</html>

How do I do this?

Nilima Chavan

unread,
Jul 20, 2010, 8:19:47 AM7/20/10
to v8...@googlegroups.com
Is that means if I am writing any web application based on v8/v8cgi,  I need to write all HTML pages using java script language?

Regards,
Nilima

On Tue, Jul 20, 2010 at 5:20 PM, Ondřej Žára <ondre...@gmail.com> wrote:
Your server side script must be a valid piece of JS code -- your example is not.

So, you might want to try something like

response.write("<html><body>");
var headers = request.headers();
response.write(headers["REMOTE_ADDR"]);
response.write("</body></html>");


Of course, for more advanced stuff, you should use templates to generate output.


Sincerely,
Ondrej Zara



2010/7/20 Nilima Chavan <nilima...@gmail.com>


--
You received this message because you are subscribed to the Google Groups "v8cgi" group.
To post to this group, send email to v8...@googlegroups.com.
To unsubscribe from this group, send email to v8cgi+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/v8cgi?hl=en.


--
You received this message because you are subscribed to the Google Groups "v8cgi" group.
To post to this group, send email to v8...@googlegroups.com.
To unsubscribe from this group, send email to v8cgi+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/v8cgi?hl=en.

Ondřej Žára

unread,
Jul 20, 2010, 9:42:55 AM7/20/10
to v8...@googlegroups.com


2010/7/20 Nilima Chavan <nilima...@gmail.com>

Is that means if I am writing any web application based on v8/v8cgi,  I need to write all HTML pages using java script language?


Yes, exactly. It is the same way you do with any other web languages (java, php, python, ruby, ...).


O.


 
Reply all
Reply to author
Forward
0 new messages