Slashdot Mirror


Asynchronous Requests with JavaScript and Ajax

An anonymous reader writes "I rarely read an entire article about a single object, especially one that is this simple. However, you will use this object over and over again in each page and application that you write that uses Ajax. This article shows you how to create XMLHttpRequest instances in a cross-browser way, construct and send requests, and respond to the server."

13 of 178 comments (clear)

  1. Hello world by jcaldwel · · Score: 3, Insightful

    This looks like the same AJAX "Hello World" I have read dozens of times before. Nothing new here.

    1. Re:Hello world by Bogtha · · Score: 2, Insightful

      You can't be looking very carefully then. Practically all the Ajax tutorials I've seen make beginner mistakes. This one's special because it's actually decent code.

      --
      Bogtha Bogtha Bogtha
  2. Ajax is OLD, web 2.0 - please.... by chrisdrop · · Score: 2, Insightful

    I am sorry - i cannot believe how much hype there is over 'ajax'. This is something that has been going on for so long. In the past - we have done this using 1x1 frames and parsed the Xml with light Js libraries. I guess I must be getting old - I always sneered at the 'mainframers' that would complain and say 'that is nothing new - we have been doing that since 1876'. Now - I guess I see the same thing. A new marketing hype name - and the old technique is here

    I hope that the next version of the web is much more than HTML pages that don't refresh with a full round trip. Really though - we did this at least 5 or 6 years ago..... I like google maps, Flickr and the others, but it is NOT a revolution. Someone innovate for real and show me a revolution if you want to justify the Ajax hype or the Web 2.0 hype!!!!

    -Irate -
    Chris

    --
    " I have no tag line. "
    1. Re:Ajax is OLD, web 2.0 - please.... by dbucowboy · · Score: 2, Insightful

      It's not about the technology as much as the innovative ways it is being implamented.

      --
      This just in! 3 out of 4 people make up 75% of the population.
  3. Re:Funny title by Kjella · · Score: 1, Insightful

    OK, here goes some /. nitpicking but it was a funny title: Asynchronous Requests with JavaScript and Ajax. Someone need a reminder of what Ajax is again (Asynchronous JavaScript And XML).

    Not to mention that it doesn't actually deal with XML, so it is not Ajax - it is just Asynchronous Requests with JavaScript. Can you say "buzzword applied without understanding or meaning"?

    --
    Live today, because you never know what tomorrow brings
  4. Re:IBM articles; Security with Javascript by Jasin+Natael · · Score: 5, Insightful
    Well, graceful degradation is nice, but...

    I think users who are disabling JavaScript are already doing themselves more harm than good. There are some genuinely good dynamic interfaces out there, and compared to the time and bandwidth savings they'll get by using them properly, the time required to install FireFox or a popup/ad blocker is negligible.

    At least for intranet and company sites, there's a genuine demand for functionality that it's impossible to expose without full Javascript support. Consider a drag-and-drop interface where customer orders appear on the left-hand side, and the line items can be organized into a grid of dates and production stations (a piece of machinery or a particular set of workers) via drag-and-drop. I have a working AJAX app that does this, but I can't think how such an application would be useful in the absence of JavaScript. It would require literally hundreds of pageloads and a metric ton of typing (remember: No Javascript = No Calendar Picker) to do any meaningful analysis and manipulation, and the very act of using it would destroy the user's workflow/concentration, rendering the application less useful than the scrawled paper notes it replaces.

    This is the direction the web is moving. There are a lot of consumer applications that would benefit from taking a more dynamic approach, especially when you combine the intuitiveness of drag and drop with the live feedback made possible by XMLHTTPRequest. I think that coddling to users without JavaScript is holding them back, as well as creating a lot of useless "busy-work" for web designers and developers.

    Jasin Natael
    --
    True science means that when you re-evaluate the evidence, you re-evaluate your faith.
  5. Re:XML isn't really needed. by ankhcraft · · Score: 2, Insightful

    Okay, I have to reply, because now you're just rewording part of my statement in lieu of a useful reply.

    I just _said_ that the XML isn't useful _unless_ you need/want communication with 3rd-party components that use XML.

    Plus, you also seem to be hinting that one should always aspire to connect their app up to 3rd-party components or even that one should always do the work to make the app integratable w/ XML before even knowing that this is necessary or required.

    I'm sorry, but this is just another example of wasted programming hours and wasted money spent on the same. If the app does not need it, nobody has asked for it, and suggestions to the contrary are not agreed with, don't build it.

    --
    ...
  6. Re:If you like this, try too AJAX Developer's Jour by Parham · · Score: 2, Insightful

    It took me less than 50 milliseconds to realize that site wasn't good... it's full of advertisements and there is little teaching going on. If I visited an AJAX-resource website, I'd like to see some code as soon as possible.

  7. Re:What to do with XML results? by bahwi · · Score: 4, Insightful

    Use AJAX without the X. JSON works quite well when XML is overkill. Sometimes you will need the complexity of XML, but much of the time(including those examples in that article), XML is complete overkill.

  8. If you dont understand all of this.... by hayriye · · Score: 2, Insightful
    * open(): Sets up a new request to a server.
    * send(): Sends a request to a server.
    * abort(): Bails out of the current request.
    * readyState: Provides the current HTML ready state.
    * responseText: The text that the server sends back to respond to a request.

    Don't worry if you don't understand all of this (or any of this for that matter)

    I think everybody understand all of this, if somehow involved with software development.

    This article is useless like 90% of the DeveloperWorks articles.

  9. Well THAT skews your results. by Andy+Dodd · · Score: 2, Insightful

    If your app requires JavaScript, then clearly, anyone who is logged as using your app WILL have JavaScript enabled.

    Your logs won't show how many people wanted to use your app but didn't because they had JS turned off for whatever reason.

    --
    retrorocket.o not found, launch anyway?
  10. Ugh by kuzb · · Score: 2, Insightful

    They lost me as soon as I saw "Web 2.0" in large bold letters. For once, can we keep the marketing BS out of techincal articles? They're like sandpaper down the side of my face.

    --
    BeauHD. Worst editor since kdawson.
  11. Re:IBM articles; Security with Javascript by phlamingo · · Score: 2, Insightful
    ... a genuine demand for functionality that it's impossible to expose without full Javascript support ...

    If only this were true ...

    The internal corporate sites I'm used have a pretty good chance of running only with I-stinking-E, using whatever demon-inspired lock-in technologies they are teaching to Microsoft "programmers" these days.

    It really twists my guts in a knot. Then, I smile, and do what I have to to get the job done.

    --
    I had forgotten how much cooler teenagers look when they are smoking. Oh, wait ...