0

I'm using a content link for my content editor. In this js file I'm tyring to load external javascript file but somehow it is not loading. Here is my code.

$(document).ready(function() { Test(); });

The method Test which is in testscript.js file never gets called.

I tried all combinations of relative paths. I also tried full URL but none of them worked.

Can someone help me in this regrads?

0
1

You can use a script editor webpart instead. But if you're going with CEWP, then upload a text file with all the references of the js files (including jquery).

1.Write this in your text file:-

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<script src="(relative path)/testscript.js">
</script>
  1. Upload this text file on in a SP Library on your site.

  2. In the CEWP properties, give the link of this text file.

0

FYI add js reference.

script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
(your code)
/script>
1
  • Reference is alredy added in the above code which I posted but it is not showing up here. It is like <script type="text/javascript" src="/AdminDocs/testscript.js"></script> Mar 18 '17 at 8:15
0

If your farm is hosted on secure connection like "https://odmain.com", or if it is SharePoint online, You need to refer script from secure site. For more information,check the console in developer tools in the Browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.