Click to See Complete Forum and Search --> : Get javascript variable data into an ASP variable


rawatson5201
12-19-2002, 10:49 PM
I have a javascript function that interogates a javascript \Select statement. In the function a value is assigned to a javascript variable. I want to get the data in the javascript variable into an ASP variable.

swon
12-20-2002, 12:58 AM
To get an variable from javascript to ASP or PHP etc., you must post it to the server, for example:

<script language=javascript>
function yourfunction()
{
// create your variables, you want maybe an variable a

var aValue = "MyValue";
var loc = self.location.href;

window.location.href = loc+"?a="+aValue; //you get the variable a with the value 'MyValue'

}
</script>