Skip to main content
October 4, 2006
Question

LoadVars in a custom class

  • October 4, 2006
  • 1 reply
  • 270 views
Hi

What I need is basicly the following: A function, that sends a query to PHP and returns the result.

What I have done so far is using LoadVars to send the query, and it is executed correctly since I can see the result in the database. The result is saved from the onLoad-function to a global variable. The problem is that the function, in which I use LoadVars, returns before onLoad has executed, and thus can't return the result of the query.

Is there any way I can get my function to wait for the onLoad to complete?
I have tried the dirty solution and made a simple while-loop, that runs while the loaded-variable is false, but that only causes it to lock up, and it never seem to get to the onLoad-function.

I have attached the code i am are using.

To sum up, what I need is a function, that can send a query to PHP and return a result.


Thanks in advance for any help
This topic has been closed for replies.

1 reply

Inspiring
October 4, 2006
c.sendAndLoad("system/timetable.php", c, "POST");
Hello I'm "c" and I am sending variables from me to php to me.
What I need is a "d" that receives the variables php are sending, because I have soo much to do...
var d = new LoadVars(); // add
c.sendAndLoad("system/timetable.php", d, "POST"); // change
d.onLoad = getResult; //change
October 4, 2006
Im affraid that didn't make any difference and the original problem still persists.
Inspiring
October 5, 2006
Of course the function returns before the onLoad completes...
You have to use something like this: