Putting a value in an object literal, as you do, does not affect the value at all.
var foo = { sendRequest: ...
The value of a function is affected only by a function expression that does not contain a name.
... function() { alert(bar.getUrl()); }
You need to specify the name that you want in the expression of the [ fiddle ] function itself.
var foo = { sendRequest: function sendRequest() {
source share