SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2002
    Location
    Scotland, UK
    Posts
    530
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Very simple, AJAX-ish question

    Hi folks,

    Having been out of the web game for a good while I only recently started mucking around with things again and one area I was wanting to look at was incorperating an AJAX style "instant view" on a commenting script I've just finished.

    The way it works just now is old school, it inserts the new comment into the database and then reloads the page to display the new comment. But thats a bit of a kludge.

    Having read a few articles on AJAX without having to use XML (eg: using PHP to generate javascript etc) I was wondering what the simplest and easiest way of my commenting script taking user input from a form, submitting it in the background and then receiving the new comments data in the background would be. It sounds fairly straight forward I know but all the articles I've seen so far seem to be fairly complex and are designed for larger purposes, and the ones dealing with using Javascript instead of XML dont appear to show how to send data out through a form, only draw data in to the page thats being displayed.

    Many thanks,

    Rikki

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suggest you forget you ever heard about Ajax. It's a usability nightmare. Leave your page the way it is; it works for all users. This forum software added a bunch of Ajax stuff and now it is very annoying to use, which is a complete blunder on the part of the owners of this site.

    I was wondering what the simplest and easiest way of my commenting script taking user input from a form, submitting it in the background and then receiving the new comments data in the background would be.
    There are lots of js frameworks now that can do it for you, but learning how to use a particular framework may be just as hard as learning to make xhr requests by hand, and with a framework if something doesn't work the way you want it to, you are stuck. So, if you absolutely insist on making xhr requests from your web pages, I suggest you keep reading tutorials until you figure out the details. Or, go to your local bookstore and look at one of the 30 or so books on Ajax that came out in the last year. I looked through the Wrox offering(a red book) one time, and it looked like it explained the basics pretty well.

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have a look at Mike Foster's xHttpRequest
    http://www.cross-browser.com/x/lib/v...m=xHttpRequest


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •