In jquery how can you pass additional parameters to an event handler function?
So for example
mySaveFunction: function(i) {
var msg = "my message " + i;
$.ajax({
...
success: this.successFunction, // i want to pass msg to successFunction
...
});
successFunction: function(response) {
// do something with msg
},
An anonymous function should do the trick here. Inside the anonymous function though,
this.successFunctionwill be undefined, so we need to store a reference tothisoutside of the anonymous function.