You need to sign in to do that
Don't have an account?
NinoJose
Is it possible to pass a variable on the callback function?
Hi guys, I would like to know if It is possible to pass a variable on the callback functions besides the result of the query or action?
Any comment/suggestion will be deeply appreciated.
Any comment/suggestion will be deeply appreciated.
However, I stumbled upon this thread
http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=4206 with cheenath's reply regarding closure in javascript and now don't need to pass the variable on the callback function.
Example below:
var result = sforce.connection.query("Select Name,Id from User", {
onSuccess : success,
onFailure : failure,
source : "This can be any js object"
});
function success(result, source) {
alert(source);
var records = result.getArray("records");
for (var i=0; i<records.length; i++) {
var record = records[i];
log(record.Name + " -- " + record.Id);
}
}
function failure(error) {
log("oops something went wrong " + error);
}
Its been a while since i have been online. I try this code you've given me. Thanks
Message Edited by NinoJose on 04-27-2008 06:53 AM