Forum Discussion
Pulling Multiple Variables into an Email via JavaScript
Hi Jennifer,
I was able to modify your code to get multiple variables into email. Please refer to the below code.
var player = GetPlayer();
var email=player.GetVar('YourEmail');
var email2=player.GetVar('SupEmail');
var email_address = email+','+email2;
var subject="Essential Soft Skills 101 Reflection";
var body_start=new Array("Opening text to introduce email");
body_start[1]=player.GetVar('Question1');
body_start[2]=player.GetVar('Question2');
body_start[3]=player.GetVar('Question3');
body_start[4]=player.GetVar('Question4');
body_start[5]=player.GetVar('Question5');
var mailto_link='mailto:'+email_address+'?subject='+subject+'&body='+escape(body_start);
emailwin=window.open(mailto_link,'emailWin');
emailwin=window.close();
I used the bold formatting for the revised line of code in the code above.
I was unable to fetch the question text and linebreaks for the user inputs because I am a novice at JavaScript.
Hope someone can assist you with that.
Please review and let me know if you have any questions.
Thank you!!