JavaScript SharePoint example of loading sp.js on demand. This only works when you have an event that loads the sp.js, not on document.ready.
$("#jqxSubmitButton").on('click', function () {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', updateList);
});//ends the onclick