473,473 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Server-Side HTML to JavaScript Vars in AJAX?

Hello,
I am breaking my head running out of ideas about the best solution to
my goal.
I want to load some pages generated with the server (ASP) and assign
their html results to JavaScript, so users could click the links and
the content of any selected page would show up immediately, making no
requests.
So, I have one main page called mainpage.asp which, I think, should
get all subpages with content, names are subpage1.asp, subpage2.asp,
etc. I tried ASP's XMLHttpRequest to get content of all sub pages and
assign html result to JavaScript variables. But I realized that MS
XMLHttpRequest does not get session protected pages. I mean that if my
subpage will generate output with session only, then even if the
session exists, MS XMLHttpRequest does not see it.
Anyway, this trick did not work. If I include these subpages in
mainpage.asp under a hidden field, this may be a solution but I do not
see it good enough yet.
What would you recommend? How would you assign subpage's html code to
JavaScript variables or array of variables?
Thank you for ideas!

Mar 24 '07 #1
3 1870
ASM
vu******@gmail.com a écrit :
Hello,
I am breaking my head running out of ideas about the best solution to
my goal.
I want to load some pages generated with the server (ASP) and assign
their html results to JavaScript, so users could click the links and
the content of any selected page would show up immediately, making no
requests.
So, I have one main page called mainpage.asp which, I think, should
get all subpages with content, names are subpage1.asp, subpage2.asp,
etc. I tried ASP's XMLHttpRequest to get content of all sub pages and
assign html result to JavaScript variables. But I realized that MS
XMLHttpRequest does not get session protected pages. I mean that if my
subpage will generate output with session only, then even if the
session exists, MS XMLHttpRequest does not see it.
Anyway, this trick did not work. If I include these subpages in
mainpage.asp under a hidden field, this may be a solution but I do not
see it good enough yet.
What would you recommend? How would you assign subpage's html code to
JavaScript variables or array of variables?
Thank you for ideas!
If I understand well ... you want :

page A :
- content of page A visible
- content of page A_0 hidden
- content of page A_1 hidden
...
- content of page A_n hidden

that's to say to force user to download :
- almost a complete site
or at least
- pages he probably will not see

Do you really think it is a good idea ?

Why having sub-pages in JS variables ?
Can't they be in clear html ?
(in not displayed divs or objects)

If subpages html codes are in JS variables, when JS will use these
variables to write (or append) the html code, associated images will
have to be downloaded on this moment ... with call(s) to server and waiting.

So ... why not the powerful XMLHttpRequest ?

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Mar 24 '07 #2
On Mar 24, 8:29 am, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
vunet...@gmail.com a écrit :
Hello,
I am breaking my head running out of ideas about the best solution to
my goal.
I want to load some pages generated with the server (ASP) and assign
their html results to JavaScript, so users could click the links and
the content of any selected page would show up immediately, making no
requests.
So, I have one main page called mainpage.asp which, I think, should
get all subpages with content, names are subpage1.asp, subpage2.asp,
etc. I tried ASP's XMLHttpRequest to get content of all sub pages and
assign html result to JavaScript variables. But I realized that MS
XMLHttpRequest does not get session protected pages. I mean that if my
subpage will generate output with session only, then even if the
session exists, MS XMLHttpRequest does not see it.
Anyway, this trick did not work. If I include these subpages in
mainpage.asp under a hidden field, this may be a solution but I do not
see it good enough yet.
What would you recommend? How would you assign subpage's html code to
JavaScript variables or array of variables?
Thank you for ideas!

If I understand well ... you want :

page A :
- content of page A visible
- content of page A_0 hidden
- content of page A_1 hidden
...
- content of page A_n hidden

that's to say to force user to download :
- almost a complete site
or at least
- pages he probably will not see

Do you really think it is a good idea ?

Why having sub-pages in JS variables ?
Can't they be in clear html ?
(in not displayed divs or objects)

If subpages html codes are in JS variables, when JS will use these
variables to write (or append) the html code, associated images will
have to be downloaded on this moment ... with call(s) to server and waiting.

So ... why not the powerful XMLHttpRequest ?

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
I guess you are right. Powerful XMLHttpRequest! You understood me
correctly. However, there are 4 tiny subpages I want to load only (not
the entire website). And the reason is that my whole website is not
AJAXed, but one section I could do in AJAX for user account
management, for example. Anyway, I do not want the half of my pages
will be regular links and half XMLHttpRequest. Instead, only one
management page will load all user account content with
XMLHttpRequest.
But how to store it and hide it? Huh? Use XML and parse it? So, there
will be HTML within XML? I am not sure...
Thanks for suggestions.

Mar 24 '07 #3
ASM
vu******@gmail.com a écrit :
On Mar 24, 8:29 am, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
>So ... why not the powerful XMLHttpRequest ?

I guess you are right. Powerful XMLHttpRequest! You understood me
correctly. However, there are 4 tiny subpages I want to load only (not
the entire website). And the reason is that my whole website is not
AJAXed, but one section I could do in AJAX for user account
management, for example.

And what about hidden objects ?

http://stephane.moriaux.perso.wanado...ulti_pages.htm

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Mar 25 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
6
by: Nathan Sokalski | last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database capabilities of ASP and IIS. I am probably using some incorrect settings, but I am not sure what they are. Here is what...
9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.