Callbaback parameters

11 views
Skip to first unread message

Salvatore

unread,
Feb 16, 2011, 10:16:06 AM2/16/11
to MochiKit
Hello,

I'm trying to pass parameters to a callback function,
in the example above : d.addCallbacks(gotMetadata, this);
i added a addErrCallback.
What i am missing ?

Tnak you for your help

Regards

Salvatore



function FormController(){
this.user = {
name: "",
valide: true,
data : "TEST"
}
}

FormController.prototype = {
fetchdata: function () {
this.user.data = "Loading...";
var d = loadJSONDoc("http://search.twitter.com/search?
q=artyprog");
var x = this;
var gotMetadata = function (meta,ctx) {
this.user.data = meta.results[0].text;
};
var metadataFetchFailed = function (err) {
alert("The metadata for MochiKit.Async could not be
fetched :(");
};
d.addCallbacks(gotMetadata, this);
d.addErrback(metadataFetchFailed);

},
save: function () {
alert(angular.toJson(this.user));
}
}
Reply all
Reply to author
Forward
0 new messages