Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2003, 02:58 PM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to prgaspar
Default Asp Results in var

What can I make to store the result of a ASP page, the HMTL, in a variable?

Pedro
 
Old August 15th, 2003, 04:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

I'm not quite sure what you mean...

If what you want is to assign some string to a variable, and then output this var to the browser:

Code:
<%
dim sString
sString = "<table cellpadding=0 cellspacing=0 border=0><tr><td>Output HTML</td></tr></table>"
response.write sString
%>
If, however, what you want is to buffer all output to the browser,
and be able to discard this in case of some condition (eg. an error):

Code:
<%
'--Turn on buffering
response.buffer = TRUE

'--Output something
response.write "This is sent to the buffer, not the browser.<br>"
'response.flush
response.write "It will be sent to the browser if we don't clear the buffer...<br><br>"

'--Some conditional - try changing it to something that returns false
if 1 + 1 = 2 then
    '--Clear the buffer 
    response.clear
    response.write "Error: Blah blah blah<br><br>"
end if

response.write "This will always be sent to the browser..."
%>
 
Old August 18th, 2003, 06:53 AM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to prgaspar
Default

For example, i have this page: teste.asp

i'd like to execute it and store the result (all HTML) in a var.

i tried this:

var1 = Server.Execute("teste.asp")

But it didn't work.

Pedro
 
Old August 18th, 2003, 09:06 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

There is a great XML object for this.
Read this article at "4 Guys from rolla"

http://www.4guysfromrolla.com/webtech/110100-1.shtml

Instead of the line - Response.Write xml.responseText
Assign the xml.responseText to a variable.

Rod

======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old August 19th, 2003, 07:24 AM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to prgaspar
Default

It's perfect.

Thank you!

Pedro





Similar Threads
Thread Thread Starter Forum Replies Last Post
using JavaScript var in C# ASP.net om_anshuman Javascript How-To 2 July 30th, 2008 01:53 PM
Using a var into the name of another var or field. guizero Access VBA 3 May 30th, 2006 03:47 PM
passing js var to asp sql okl Javascript 1 March 11th, 2005 05:40 AM
passing js var to asp sql okl Classic ASP Databases 1 March 11th, 2005 05:01 AM
access returns results but not when through ASP whyulil Classic ASP Databases 4 June 8th, 2004 11:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.