Forum Moderators: open

Message Too Old, No Replies

Passing JS Variable into ASP code

Javascript into ASP

         

powerslave

12:34 pm on Apr 14, 2005 (gmt 0)

10+ Year Member



Hello

I'm not the most experienced at ASP or JS but I need to pass a variable like

function whatever() {
totalprice = price * quantity
}

<%
Insert into tblSales (SalesTotal) Values totalcost
%>

Ive never done an asp section using JavaScript, if its possible? if so maybe i can do the whole database entry in this JS function?

or maybe need some kind of global variable that they both understand?

Hell I dunno :)

How would u do this?
thanks

natty

12:41 pm on Apr 14, 2005 (gmt 0)

10+ Year Member



hi powerslave,

i see this is your first post so i feel i should do the
welcome to webmasterworld
and tell you to read the TOS [webmasterworld.com] :)

afaik, the only way to do this would be to pass something to the asp page in the querystring ( or submit a form).
you can use JS to change the url, but that would mean a refresh of your page, or going to another one.

function blah(){
document.URL = "something.asp?this=that";
}
then in the asp as you probobly know you can get the querystring and build your query like that.
or something like that, my JS is a little rusty, im sure w3schools would help you out there.

as asp is server side, it cant do anything on a page that has already loaded.

hth

nat