Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > AJAX Question

Reply
Thread Tools

AJAX Question

 
 
Joel Byrd
Guest
Posts: n/a
 
      01-21-2006
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...

 
Reply With Quote
 
 
 
 
Murali IPRLAB
Guest
Posts: n/a
 
      01-21-2006
for center part (content part) why don't you use iframe to display
information which contain forms and other ? just suggestion.
--> Murali <--
Joel Byrd wrote:
> 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...


 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      01-21-2006
Joel Byrd wrote:

> 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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      01-21-2006
David Dorward wrote:
> Joel Byrd wrote:

<snip>
>> ... Is this just a really bad idea to begin with, ...

<snip>
> 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.


 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      01-21-2006
Digital wrote:
> 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.


<snip>
>... . 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An Ajax Dictionary... My first AJAX project... GreatDomainz@gmail.com HTML 20 03-31-2008 01:24 PM
Deploying ASP.NET AJAX-Enabled Web site to host without AJAX insta =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?= ASP .Net 2 02-21-2007 10:22 PM
AJAX IDE and AJAX TOOL--The Release of JoyiStar AJAX WebShop 3 Beta minnie Java 1 12-13-2006 06:29 AM
Ajax installed.. where are Ajax controls like popup in my VS toolbox ?? jobs ASP .Net 0 11-06-2006 01:23 AM
beginner AJAX questions (AJAX.net) darrel ASP .Net 5 04-28-2006 06:42 PM



Advertisments