[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Pulling in ASP variables to Javascript email script

Posted on 2006-05-10
8
Medium Priority
?
309 Views
Last Modified: 2008-02-01
Hi Experts

I am looking to create an email pop-up (preferably in Outlook format) that pulls in ASP defined variables. I have found a simple Javascript email pop-up that does the job with fixed text perfectly, now I want to add the variables, for example;

//get email address
Set objRS = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT dbemailaddress FROM tblcustomer "
strSQL = strSQL & "WHERE dbenquiryid='" & EnquiryId & "' "

objRS.Open strSQL, objConn

SQLemailID = objRS("dbemailaddress ")

//Javascript POPup

<script language="JavaScript">
<!--
// POP UP A EMAIL MESSAGE WINDOW
function popupMessage() {

  // SET MESSAGE VALUES
  var to = SQLemailID;
  var subject = "Email Message";

etc............Can I pass a variable created in ASP into a Javascript ? If so what is the correct syntax?

Many thanks
RangerLad
0
Comment
Question by:RangerLad
  • 3
  • 2
  • 2
7 Comments
 
LVL 12

Expert Comment

by:Proactivation
ID: 16646681
The standard way of doing it is to use ASP to write out your Javascript to the browser, and inserting the variables in the right place.
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 total points
ID: 16646724
Like this:

<script>
var to = "<%= SQLemailID %>";
var subject = "<%= my_Asp_VarMessage %>"
// or
var subject  = unescape("<%= Server.UrlEncode(my_Asp_VarMessage_Escaped_If_Contains_LineFeed) %>")
</script>
0
 

Author Comment

by:RangerLad
ID: 16646877
That has put me on the right track mplunjan, many thanks

RangerLad
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Expert Comment

by:Proactivation
ID: 16646890
Hope my (correct) answer helped.  Thanks for the total lack of points!
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 16646908
@Proactivation: Your comment was very vague and completely lacking examples.
0
 

Author Comment

by:RangerLad
ID: 16646929
I was really looking for an example of the syntax that should be used as I am new to Javascript, thanks for your input anyway Proactivation
0
 
LVL 12

Expert Comment

by:Proactivation
ID: 16646943
It was also correct, and understandable by anyone with basic ASP knowledge.  Split points are there for a reason...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question