SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Ajax Question

  1. #1
    SitePoint Zealot
    Join Date
    May 2007
    Location
    West Midlands, UK
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ajax Question

    I have a script that processes information for anything up to 10 minutes.

    Currently, when the user clicks the submit button on the form it goes to a seperate page and says "processing".

    Instead I want a popup (which I can do) that displays an apple loading image and some text and greys out the background.

    The problem is, how would I submit the form without leaving the page? The logic is separate from the view, so I don't want to include the logic in with the page.

    Im guessing I will have to return a response using Ajax to display information once it's finished.

    Any help on this would be grand.

  2. #2
    Non-Member
    Join Date
    Oct 2007
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take a look into JSON. You'll find mootools helpful for processing JSON., and there are plenty of server-side libraries for each languange. You can shoot a form back and wait for the response. I would recommend only using single dimension arrays to start.

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure I understand what kind of an answer you're looking for regarding the logic and the view. One way or another, you need the server to be able to identify an ajax request so that it can respond appropriately to it, since the response is probably going to be different.

    You're probably going to want to send the initial request, and then periodically poll the server to ask if its done. When it is, the server will either send the results directly to ajax, and use js to render the updated ui with the data it received, or you just poll until you eventually get a "done" reply from the server, and at that time just change the url and goto the next page.


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
  •