Re: How do we get there from here?




Tom deL wrote:

> Hi Dawn,
>
> <snip>
>
> > > Well ... I am not really sure. Are you saying that if the HTML portion
> > > of the AJAX system is sent to the browser via a PHP(ASP, JSP) script
> > > ('document'? in your terms) this somehow makes it a different system or
> > > approach than if the HTML content is acquired via a normal http GET
> > > request?
> >
> > You can write browser-based applications that DO the same thing, but
> > yes, it is different in that there are more "moving parts" on the
> > server and your xhtml pages are integrated with php, where in the ajax
> > approach you have an xhtml page that gets shipped sans php/asp/jsp
> > executing on the server as a pre-processor. That makes for cleaner
> > code in my opinion and I'm guessing it is more maintainable -- just a
> > hunch at this point. --dawn
>
> OK, I will be the first to admit that I am easily confused so please
> bear with me here ...
>
> My understanding of AJAX is basically:
>
> 1. In an HTML document, a CSS named division, span or whatever is set
> up that will recieve some content (<span id='something'>Content will go
> here</span>).
>
> 2. In the same document, a bit of javaScript is set up which will use
> the XMLHttpRequest method to initiate a request to the server
> (req.open('GET', url, true);).
>
> 3. In number 2. above, a callback routine is set up which will 'catch'
> the request upon completion (req.onreadystatechange = function;) The
> callback then loads the content supplied by the above call into the
> abovementioned div, span, input, whatever by using javaScript to inject
> it into the desired DOM element (document.something.innerhtml =
> req.responsetext)
>
> What additional complexity am I missing?

I read it quickly, but it sounded right to me.

> The above seems to be the way
> everything is being done. If there are client side versions of PHP,
> which browsers support them?

Ah, here is the issue -- there is only one computer language (in which
one can define functions, for example) that runs on the client. PHP,
ASP, JSP are all strictly server-side. They might push html to the
client, but all interpretation or run-time of these pages executes on
the server necessarily. We are stuck with JavaScript as the only
language that operates in the client browser environment and can
integrate with the page components. I have to add that last part
because Java can run on the client side with a java run-time
environment operating there, for example, but has no ability to
interact with the page.

> How is a PHP document structured?

It is often html/xhtml with a language intertwined. When a page is
requested, the web server runs the source code through a pre-processor
and then passes the resulting html to the client.

> This
> name implies a static text file, is it different from a PHP script?

PHP and a PHP script are the same things. PHP is a way to intertwined
a server-side-run-time scripting language into html, while javascript
is a client-side scripting language (although I understand the is
server-side javascript too, but how you get an ISP to support that, I
wouldn't know).

> In deepening confusion,

I'm likely doing too fast a brain dump. My AJAX presentation is much
better and I am not exactly an expert, just somewhat well-read at this
point.
cheers! --dawn

> -Tom

.



Relevant Pages