I'm trying to use ScriptResx.ashx in an Application Page I'm building (just to test out the functionality) and every time I try to grab a resource from what should be a JavaScript object, SharePoint comes back and tells me that SP.Publishing.Resources is not a valid object. What bothers me is that I can run http://dev/_layouts/15/ScriptResx.ashx?name=sp.publishing.resources&culture=en-us in the browser and I get an entire Javascript object (with namespace returned):
_EnsureJSNamespace('SP.Publishing');
SP.Publishing.Resources=
{spellcheckerCheckSpelling:'Check Spelling',
...,
cui_stt_ButVariationsMenuListSettingsTooltip15:'View variation list settings.'};
if (typeof(Sys)!='undefined' && Sys && Sys.Application) { Sys.Application.notifyScriptLoaded(); }
The code I'm using in my Application Page is as follows:
<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<script type="text/javascript" src="/_layouts/15/Scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function pageLoad() {
RegisterSod("sp.publishing.resources.resx", "/_layouts/15/ScriptResx.ashx?name=sp.publishing.resources&culture=en-us");
var test = SP.Publishing.Resources;
$('#testDiv').text(SP.Publishing.Resources.toString);
}
</script>
Does anyone know what I'm doing wrong?