Adonis, The $.post() function is asynchronous (by default) when your code hits a $.post() call, it'll keep executing code. In order to do something with the results of your AJAX call, you'll want to use the callback option--which is a function run when the AJAX call is completed.
-Dan On Thu, Oct 8, 2009 at 7:14 AM, Adonis <achrysoch...@hotmail.com> wrote: > > I am not entirely sure if i am using proper definitions here, but here > it goes.. > > I have $.post() inside javascript functions. If ajax is successfull, > it returns data from the server. I am trying to assign this data to > javascript global variables. The problem is that my global javascript > variables end up to be empty. It seems it takes time for the ajax to > return the data and by the time the server data is returned, the > browser has comploted reading through the rest of the javascript > functions. Thus, leaving my global variables empty. > > Do you have any suggestions on how this could be fixed? I am trying > setTimeOut() at the moment but i would be glad to concider other > solutions as well.. > > I could provide code examples on request. > > Thanks in advance! >