What would be the best way to return the iM variable, and where would I put the coding at?
Code: Select all
...
function lV(urlToLoad, targetUser) {
var _send = new LoadVars()
var _load = new LoadVars()
// Set parameters to send
_send.mN = String(targetUser);
// Handle the remote data
_load.onLoad = function(success, errorMsg)
{
if (success)
{
trace("Data received:")
trace("iM : " + this.iM)
iM = this.iM;
trace("iM 1 = " + iM);
return iM;
}
else
{
trace("Loadvar Failed. " + errorMsg)
}
}
// Send data with POST method and receive it back in the _load object
_send.sendAndLoad(urlToLoad, _load, "post")
}
...The return code I'm currently using in the coding above comes out to undefined, rather than the correct value that is being traced.
Does anyone know why and/or how to fix it?