Discussion:
Callbaback parameters
Salvatore
2011-02-16 15:16:06 UTC
Permalink
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));
}
}
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mochikit+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en.
Loading...