SharePoint 2013 server...
I have created a custom aspx page for use as a modal dialog. I want this pop up to collect field values and return them to the form the pop up was called from. The pop up opens fine, but when I click 'OK' I get.... 'SP' is undefined.
Using a button, I am loading sp.js (as below) before calling my close and pass data function (which contains the error line above). Is there another SharePoint library I should be loading?
function loadScripts(){
SP.SOD.executeOrDelayUntilScriptLoaded(closePopupAndPassData, "SP.js");
}
function closePopupAndPassData(){
var fakeData = "test";
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, fakeData);
}
Thanks in advance for any feedback.