aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes AJAX lag issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX lag issue" Watch "AJAX lag issue" New topic
Author

AJAX lag issue

Bill Clar
Ranch Hand

Joined: Sep 21, 2006
Posts: 150

I have the most peculiar AJAX/Javascript problem. I'm having difficulty retrieving the value returned from an AJAX request.

I'm assigning the XMLHttpRequest.responseText value to a simple text field. When I try to retrieve this very field, the info
is undefined. I can see it populated on the screen in the text field, but I cannot retrieve it.

If I call an alert() on the field, it's undefined. If I call alert() a second time, the value appears.

Does AJAX have some sort of lag that prevents or hinders the user from retrieving the XMLHttpRequest.responseText data? Do I need to do something more
than ensure the state and status of the AJAX object are successful?

Thanks,

Bill Clar


Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are making an asynchronous request, not a synchronous one.

You make the Ajax call and it continues on its way, it does not wait til it comes back.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60990
    
  65

In other words, you can't check the value before it gets set and expect it to be there


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AJAX lag issue