The signatures for the callback functions are fixed - so you can't add your own arguments to those.
Your callback function can see any variables that are in their parent scope (or their parent's parent, etc.) so, that is one way to see additional data (as you discovered). If you're using a global variable, one downside would be that you can only have one copy of those variable values at a time.
Another mechanism would be to have a 'function factory' that can be called to create your callback functions with your extra variables:
function createCallback(extraVar1, extraVar2)
{
return function(resultData) {
ogscript.debug('You got ' + resultData + ' and your extra variables were ' + extraVar1 + ' ' + extraVar2);
}
}
ogscript.asyncPost('http://www.rossvideo.com', null, createCallback('Hello', 'World'));
Another option may be helpful depending on what the data you're looking to use in your callback. You can call
ogscript.asyncPost(URL, DATA, CALLBACK, INCLUDE_RESPONSE); Where INCLUDE_RESPONSE is true or false. If true, resultData contains more information than just the text from the URL.
You'll have:
resultData.responseCode; //THE HTTP response code (generally 200)
resultData.url; //The URL the response is for
resultData.contentType; //The content type of the response
resultData.bytes; //If the returned content is binary
resultData.value; //The original returned string
#DashBoard