My project is SharePoint-Hosted Add-in and i want to verify if script sp.js is loadded before run my code in App.js file.
When i use
$(document).ready(function () {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', pageLoad);
});
I have load this js files:
<!-- Required references to use the JSOM from a SharePoint-hosted html page -->
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"></script>
<script type="text/javascript" src="../_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="../_layouts/15/sp.js"></script>
<script type="text/javascript" src="../_layouts/15/sp.ui.controls.js"></script>
When i insert SP.SOD.executeFunc worked, bu pageload, refreshed two times...
Tommorow when i uses Promise.then or .done in this post error is the same :
jQuery.Deferred exception: Unable to get property 'then' of undefined or null reference TypeError