Question : Pass variables from javascript to ASP classic page

I have 4 variables that I am trying to send from a javascript function called generatepsw in manageusers.asp to an ASP page called sendemail.asp.

I have done loads of googling but it just doesnt make sense to me.  Ive seen examples of using AJAX and JQuery and actually I have a reference to JQuery already in my code (the orginal code was written by someone else).

I think I'm now going around in circles.  The four variables are sendemailemail, sendemailpassword,sendemailusername and sendemailfullname.  The intention is then to send out an email using those variables.  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
function generatepsw() {

if ($("#xEmail").val() == "")
alert("No email given")
else {
var strPassword = "";
for(var i=1;i<=10;i++) {
if((i%2)==0)
   strPassword += String.fromCharCode(Math.floor(Math.random() * 10)+ 65);
else
   strPassword += Math.floor(Math.random() * 10)+1;
}
$("#xPassword").val(strPassword);
$("#xPassword2").val(strPassword);

sendemailemail = $("#xEmail").val();
sendemailfullname = $("#xFullName").val();
sendemailpassword = $("#xPassword").val();
sendemailusername = $("#xUserName").val();

saveuser();
window.location = "sendemail.asp"
1:
2:
3:
4:
5:
6:
7:
8:
9:
<% 
        senditemail = session("sendemailemail")
        senditusername = session("sendemailusername")
        senditpassword = session("sendemailpassword")
        senditfullname = session("sendemailfullname")
        
        Response.Write("Sending - Redirect in 5 seconds")
        'Response.AddHeader "Refresh", "5;URL=manageusers.asp" 
%>

Answer : Pass variables from javascript to ASP classic page

In similar cases i have used hidden fields to pass the variables
Use this if it helps

1. Create a form tag (or use the one if you already have) and put the hidden fields inside that
ex
<form name='f1' method='post' action='yourpage.asp'>
<input type='hidden' name='username' id='username'>
<input type='hidden' name='password' id='password'>
<input type='hidden' name='email' id='email'>

</form>

2. in Javascrip set the values for each hidden field using
document.getElementById("username") = "gizmogeek";

3. submit the form using javascript
f1.submit();

hope this works
Random Solutions  
 
programming4us programming4us