Slashdot is powered by your submissions, so send in your scoop


Forgot your password?

So How Do You Code an AJAX Web Page? 231

PetManimal writes "Computerworld has a long excerpt from a book by Edmond Woychowsky about how to code Web pages in AJAX. It gives a good explanation of how the technology works, and also has some visuals and code snippets that you can play with. From the article: 'Beyond the XMLHTTP Request object, which has been around for several years as a solution looking for a problem, there is nothing weird needed. Basically, it is how the individual pieces are put together. When they're put together in one way, it is nothing more than a pile of parts; however, when put together in another way, the monster essentially rises from its slab.'"
This discussion has been archived. No new comments can be posted.

So How Do You Code an AJAX Web Page?

Comments Filter:
  • by not already in use ( 972294 ) on Friday August 04, 2006 @03:34PM (#15848357)
    With the growing popularity of AJAX does anyone think it's time to update the HTTP spec? AJAX is cool tech but still hindered by the fact that the client has to initiate every request. Yes, there are ugly hacks to keep a connection alive, but it is exactly that, a hack, and introduces problems of it's own.
  • by suggsjc ( 726146 ) on Friday August 04, 2006 @03:36PM (#15848374) Homepage
    I can see both sides of the argument, but do you really want a two-way connection through your browser?
  • by __aaclcg7560 ( 824291 ) on Friday August 04, 2006 @03:50PM (#15848477)
    It's a series of tubes.

    You got it all wrong about the tubes [], my friend. :P
  • by catbutt ( 469582 ) on Friday August 04, 2006 @04:16PM (#15848644)
    I think the more limiting issue is that it is so hard to do AJAX across domains. XMLHttpRequest doesn't work, nor do hidden iframes. I think no one has put too much thought into what the potential of this is if it could be done.

    However, they appear be building something at [] that is supposedly a clean, open source solution to this, by packetizing the data in javascript script urls. Apparently their release is a few days off.
  • by YU Nicks NE Way ( 129084 ) on Friday August 04, 2006 @04:31PM (#15848723)
    the XMLHTTP Request object, which has been around for several years as a solution looking for a problem, there is nothing weird needed
    OK, so this guy doesn't even know that HttpRequest was added to MSXML to allow OWA 2000 -- you know, the first Ajax client -- to work. SOunds like he's got some technical issues to work through first.
  • Speaking of AJAX... (Score:5, Interesting)

    by Chabil Ha' ( 875116 ) on Friday August 04, 2006 @04:53PM (#15848844)
    Why doesn't Slashdot implement it? This would be especially nice for expanding/collapsing in the discussions.
  • by CastrTroy ( 595695 ) on Friday August 04, 2006 @05:02PM (#15848902) Homepage
    Light Tools? What are you talking about. My current copy of Visual Studio is eating up 290 Megs for RAM. I will go with you on your opinion though. VS.Net is a great tool, and probably one of the best editors I've ever seen. The bad part is that it's hidden behind the drag and drop interface that it presents. MS tools get you to focus on the GUI, and don't make you get underneath to understand what's going on. This leads to a lot of programmers who can get their way around VS easily enough, and even write some good programs, but as soon as they need to do something that visual studio didn't expect, they have a really hard time.
  • by bryanbrunton ( 262081 ) on Friday August 04, 2006 @05:41PM (#15849085)
    I recently published my first Ajax application. It is an online game called Grand Strategy, a close of the well known board game Risk.

    It is by far the most advanced Ajax based implementation of a board game to have ever been written!

    I used Direct Web Remoting (DWR) and the Dojo Toolkit. My javascript talks to my server side java beans directly. It's really the easiest web programming model I have ever seen. I hurts to go back to doing ASPX and PHP pages after this.

    Check it out here: []
  • Re:Use Echo2 (Score:3, Interesting)

    by master_p ( 608214 ) on Saturday August 05, 2006 @08:30AM (#15851787)
    I have been developing an intranet application with Echo2 for 3 months now. Although the concept is great, it takes a lot (and I mean A LOT) of effort to write the GUI using Echo2:

    1) the Eclipse plugin is shareware. Since the project I am doing is small, no extra expenses were allowed, so I did everything manually.

    2) the widgets are minimal, to say the least. The core library contains very few widgets (button, label, text field, text area, table, grid, row, column, splitpane, windowpane). You have to download an extras library.

    3) the widgets' look and feel is 'black text and white background'. You have to manually specify the visual output for all states of each widget. For example, you have to specify, for the button, the background color, border, font color for each of the disabled, enabled and selected states.

    4) The above is somehow solved with styles provided in XML. But this part of the library is totally undocumented. I mean there is not a single line of documentation of how the XML style files should be. I posted the relevant question in their forum and they said to look at the examples.

    5) The GUI is single-threaded (each connection has its own thread). If you want to add something to a model from another thread, you have to write a task which will be executed in each client's message queue. Which means that you either make new models which are synchronized or each client maintains different model instances for the same data...which means a huge waste of memory.

    6) geometry management is weird, to say the least. Many components do not autosize themselves to the available space of their containers or have weird constraints. You have to use splitpanes for most tasks, but they have some severe drawbacks: panes can not be children of non-panes.

    7) widgets are pretty limited in functionality. For example, there is no way to scroll a text area content to the last line in order to simulate a command prompt window, for example.

    8) there are maybe some weird bugs in it. Some times the communication between browser and server freezes, even if both are on the same machine.

    9) data validation on the client is not existent. You just accept whatever the client sends you.

    Overall, Echo2 is pretty average...the concept of 'all Java' is great and saves you a lot of trouble...but I think Echo2 needs a great deal of work to make it really good.

    What I would like to see is Java bytecodes be translated to ecmascript and run on the client. That would save many hours of coding, as well as make applications much faster and nicer. For example, I would like to write a data validation routine in Java, and I want this routine to be translated to javascript and executed on the client side, thus not needing to get back to the server and bog down the network.

"We don't care. We don't have to. We're the Phone Company."