SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: AJAX Problem

  1. #1
    SitePoint Evangelist ashattuc's Avatar
    Join Date
    Aug 2002
    Location
    Boise, Idaho
    Posts
    411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    AJAX Problem

    Hello,

    I've been trying to figure out how to solve this problem for a while.

    On a page, I have the javascript function "processStateChange()" to deal with AJAX requests. But if the page needs to use it simotaniously for two requests, it only processes the last one.

    For example, I have two buttons that make an AJAX request using the same processStateChange() function. I click button1. It begins to process the content to replace the content on the page. Before it is finished, I click button2. Button 1 is then frozen in it's state, and the processStateChange() starts deailing with the process associated with button2.

    How do I deal with allowing multiple requests to the function, without stopping it? Basically, having a queue of requests that it processes in order?

    Thanks!
    Chris
    Chris S.

    Free Web Scripts - Form generators, AJAX tools and more!
    Micro CMS - A totally free AJAX-based, SEO-ed CMS!

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    About that yes. I had that issue once, and it was mainly a timing thing. One button request overrides the other before it gets a chance to process the data.

  3. #3
    SitePoint Evangelist ashattuc's Avatar
    Join Date
    Aug 2002
    Location
    Boise, Idaho
    Posts
    411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Exactly! So how do I keep if from overriding the function?
    Chris S.

    Free Web Scripts - Form generators, AJAX tools and more!
    Micro CMS - A totally free AJAX-based, SEO-ed CMS!

  4. #4
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The best way I've found so far is to initialize a new XMLHTTP request (or that active x thingy) and use that to initiate a seperate call.

  5. #5
    SitePoint Evangelist ashattuc's Avatar
    Join Date
    Aug 2002
    Location
    Boise, Idaho
    Posts
    411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Chris. I ended up using http://www.ajaxtoolbox.com/ for the basic Ajax processing. It covers mutiple requests and simple form submission, so it will work out nicely.
    Chris S.

    Free Web Scripts - Form generators, AJAX tools and more!
    Micro CMS - A totally free AJAX-based, SEO-ed CMS!


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
  •