The result of buildMyUrl is always undefined in the calling function. I'm not sure what I'm doing wrong chaining these functions:
var buildMyUrl = function (callback)
{
var param;
var addParams = function (domainUrl)
{
domainUrl += "page.aspx?";
domainUrl += "Param1=";
};
$.when(self.buildDomainUrl()).then(addParams);
};
buildDomainUrl
returns a JQuery promise and adding parameters works fine.
Now I have a function that would like to use the result of buildMyUrl
:
var buildAPageUrl = function ()
{
var dfd = $.Deferred();
var addCalendarPage = function (domainUrl)
{
dfd.resolve(domainUrl += "/Calendar.aspx?");
};
// Here lies the problem (buildMyUrl is undefined)
$.when(buildMyUrl()).then(addCalendarPage);
return dfd.promise();
}