Accessing a REST WebService and updating local HTML objects with Modular JS
declared but never used:


url
data (it my look like it is used but it is only assigned to results and card)
results
card


used but never declared:


baseUrl
mainSettings (though there is a comment about it)
value


Unnecessary:


applyLanguageSettings
settings
obj
status
jqXHR


I had to assume card and value were the same thing or else as mentioned above data wasn't really used. Readability can be improved by giving dfd a name that would be understood by more people. I also made use the the data setting for the ajax function.

Potential rewrite:

$(function() {
    var language = mainSettings.getLanguage(); /* there is an object in the page called mainSettings with current language */
    language = language === "en" ? "en" : "es";

    var pageName = window.location.pathname.split("/").pop();
    pageName = pageName.substring(0, pageName.indexOf('.aspx'));
    var understandableName = $.ajax({
        url: mainSettings.getUrl() + language + "/db/items",
        data : { "$filter" : "PageName eq '" + pageName + "'" },
        method: "GET",
        headers: {
            "accept": "application/json;odata=verbose"
        }
    });

    understandableName.done(function(data) {
        if (!data.d)
            return;
        var results = data.d.results;
        if (results &amp;&amp; results.length &gt; 0) {
            var value = results[0];
            $("#Img").attr("src", value.Img);
            $("#Title").text(value.Title);
        }
    });
});