My script works like this.
First I'm calling a function named getRecordCount() that does an Ajax
request and updates one of my objects variables.
After that I'm trying to use that variable in another function, but
the value is null. The request haven't finished before my other
function already trying to use the result of it.
So my question is, how do I first run function number one, and when
that function is finish, I call function number two?
Simplification of my code:
var myObject = {
//Default values
currentRecord: null,
initialize: function() {
//Call request and set value
this.getRecordCount()
//My other function
myOtherFunction();
},
getRecordCount: function() {
var myAjax = new Ajax.Request(
'getObjects.aspx',
{
method: 'get',
parameters: '',
onSuccess: function(response) {
myObject.recordCount = eval('(' +
response.responseText + ')');
}
});
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---