- The path may not be resolved correctly (sometimes relative urls seem just not to work correctly in SharePoint context)
- When using jQuery in Javascript within e.g. a SharePoint webpart try to use jQuery.noConflict() before using the SP-Services. In most cases I had issues with using $ or jQuery because of the already loaded JQuery within SharePoint.
- When using javascript in SharePoint $(document).ready might cause problems because this doesn´t actually mean that all content is loaded. You can try to use _spBodyOnLoadFunctionNames.push("myfunction") instead.
- Use ExecuteOrDelayUntilScriptLoaded(temp(), "jquery-1.10.1.min.js");
- $.getScript("jquery.SPServices-0.7.2.min.js",[optionalFunction() { }]); OptionalFunction() will execute after jquery in 1st parameter loaded successfully
Wednesday, November 25, 2015
How to load Javascript file properly
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment