AJAX Question

J

Joel Byrd

I want a website that works in the following way: It has a main
content div, and of course menu items. When you click a menu item, it
should use AJAX to change the main content div to the content of the
page of the menu item you clicked. So, for example, if you clicked
"About Us", then in the main content div, you would see the content of
the about us page. Now, this is pretty simple if the content of a
given page is just text (I just get the content of the page and set the
innerHTML property of the div to this content - I know there are
different opinions on the Kosherness of innerHTML, but...). But the
rub lies when the page that I want to fill the main content with
contains more than just simple html. For example, it is a contact form
and it contains some javascript for client-side form validation. It
gets a little icky when I'm trying to dynamically load javascript using
AJAX (in other words, it doesn't work - either the responseText is
invalid or the status returned is not 200, and I know this because the
code is not getting past the following condition: if
(http.responseText.indexOf('invalid') == -1 && http.status == 200)...

Are there any thoughts on using AJAX to dynamically load content on the
fly that is more than just plain html (I guess this means at least
javascript)? Is this just a really bad idea to begin with, are there
decent methods of doing this, etc...
 
M

Murali IPRLAB

for center part (content part) why don't you use iframe to display
information which contain forms and other ? just suggestion.
--> Murali <--
 
D

David Dorward

Joel said:
Are there any thoughts on using AJAX to dynamically load content on the
fly that is more than just plain html (I guess this means at least
javascript)? Is this just a really bad idea to begin with, are there
decent methods of doing this, etc...

Since it sounds like you are replacing the majority of the page, you are
effectively just reinventing frames - along with all their problems (like
bookmarkability, search engine unfriendlyness, etc, etc) but with the bonus
of requiring the user to have JavaScript. So, it sounds like a really bad
idea.
 
R

Richard Cornford

David said:
Joel Byrd wrote:
Since it sounds like you are replacing the majority of the
page, you are effectively just reinventing frames - along
with all their problems (like bookmarkability, search engine
unfriendlyness, etc, etc) but with the bonus of requiring the
user to have JavaScript. So, it sounds like a really bad idea.

The javascript dependence is not the end of the story because
XmlHtttpRequests on IE require that ActiveX be configured to be
scriptable in the applicable security zone. The majority of browsers may
be IE, the majority of IE browsers may have scripting enabled, and the
majority of script-enabled IE browsers may allow the scripting of
ActiveX in the Internet security zone, but a majority of a majority of a
majority may end up being a minority of the total.

It is not really realist for a public web site to ask to be added to the
'Trusted' security zone in order that it works at all. That request
alone would represent reasonable grounds for suspicion on the part of
the user.

AJAX may be a viable strategy for the creation of web applications and
on Intranets (where users will accept a requirement place the
application/Intranet in the trusted security zone in order to use it)
but its use on public web sites is extremely suspect.

Richard.
 
R

Richard Cornford

Digital said:
You do not need to worry about that with IE.

By which I assume you mean that you do not want to worry about it.
By default the XMLHTTP ActiveX object will work even
after installing SP2 for XP.

It would be inept not to consider the possibility that use configurable
software may be subject to user configuration.
You will not need to ask your users to do anything.

Certainly I will not need to ask my users to do anything, but that will
be a consequence of considerate design rather than burying my head in
the sand.
This is because it is installed and configured as executable
when you install IE, unlike other ActiveX controls that the
user installs afterwards.

And it takes one interaction with one checkbox to turn it off.
There are a few other ActiveX controls that also continue
working with XP after an SP2 install. I believe Flash is
one of them.

And what of SP3 or 4? Microsoft's recent habit when responding to
security concerns has been to increase the default restrictions that
apply to various security zones, rather then fix the problems at source.

But still, as installed is only as operated in the majority of cases,
and the size of the minority that chooses to be more secure is not going
to be practical to determine.


... . The only users you really need to worry about are
those on corporate networks that have had the XMLHTTP
object disabled.

Ah, yes. The people with the big money.
This is very rare as the object has been heavily used in
the enterprise for close to 8 years by corporations offering
OWA to their employees. In addition many web based enterprise
apps have been using the webservice.htc for years now and that
relies on the XMLHTTP ActiveX object.

And it is perfectly normal for web applications and Intranets to operate
in their own security zones, so the use of XmlHttpRequests in business
(and particularly inside businesses) has no barring on what may be
suitable for a public Internet site.

<snip.
.. . So the bottom line is that unless a user specifically
disables it, the XMLHTTP ActiveX object will be available
to you.

So it is enabled unless it is disabled. The question is; is scriptable
ActiveX being disabled a good reason for a public web site to be turning
away visitors/customers (and who should be making that (theoretically
business) decision). Plenty of web sites have been created and worked
reliably without a dependency upon XmlHttpRequest.
"Richard Cornford" <Richard@...
<snip>

Please do not top-post to comp.lang.javascript.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top