Ajax Execution without an event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Leo Smith
    New Member
    • Mar 2007
    • 45

    Ajax Execution without an event

    Quick question and I am sure I just can't find the answer here. Is there a way to make an Asynch request from a browser without having to use an event? The only way I have found in ASP.NET is to create an event (i.e. onclick) then from within my javascript have it exe document.getEle mentById('myCon trol').onclick( ). This works, but I find it a bit limiting, especially if I want to make a set of stacked calls to the server, based on settings on the form and what is being returned. Also, firing multiple events tends to throw exceptions that kill the client.

    Thanks,
    Leo
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    But when would you want to do it? You could perhaps make the request after a certain time using setTimeout or setInterval.

    Comment

    • Leo Smith
      New Member
      • Mar 2007
      • 45

      #3
      The came when I needed to verify that the user was valid. This becomes an issue when the user has not used the application for a specified time (i.e. 15 min). You may no longer be sure that the user is the one who started the session, so you have to validate the user first. This leaves you with the possibility that the user needs to log back in before you continue the callback. Since I am running the login routine through AJAX callbacks and not destroying the current form values the user has entered, I would like to break into the normal flow validate, and then when the user has validated, then pickup where I finished. This has caused OutOfIndex exceptions to be thrown on the Callback stack. Very frustrating. I have made some hacks to make it work (sort of, the user needs to redo their last action), but I would like a cleaner user experience. So this is one way I could make use of the able to break into an event a send the routine to verify the login and then pick back up without throwing exceptions. I realize there are probable threading issues that may need to be looked at if I can find a way to run various callbacks during the launch of a single event.

      Thanks,
      Leo

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        I am not sure if I have understood correctly.

        I've never done this, but perhaps you could pass the form details to the function dealing with the login and set them again if need be.

        Maybe have two Ajax requests?

        I think if you could post some code, it might help. Also what kind of events would you be talking about?

        Comment

        Working...