0

I am having a script

   <script src="/_layouts/SP.js" type="text/ecmascript"></script>

      <script type="text/javascript">

     function ViewItem()
    {
this function calls sucess function or failure function }

function success() {

 }

  function failed(sender, args) {
 }
   </script>

This script has to call sp.js which i refered in html page. I need to write this script in seperate file and call this function viewitem from my html page

3
  • 5
    And what's your problem/question? I recommend to remove the type attributes. Commented Oct 24, 2013 at 6:28
  • You don't have to use TYPE there, and why are you using type as ecmascript? Commented Oct 24, 2013 at 6:29
  • Okay, thanks for the comment and ecmascript is for getting list from sharepoint and this viewitem() function need to access that SP.js file. Now i need to place this script in seperate .js file and call that viewitem function Commented Oct 24, 2013 at 6:32

1 Answer 1

0

You don't have to use TYPE there, and why are you using type as ecmascript?

Good programming practice is that you use the filename in lowercases, I am not sure if that is the issue (that your file is sp.js and you are calling SP.js) but sometimes it is on linux machines

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for the answer it is SP.js which is sharepoint file which i have no control of
Wait, do you mean you want to create a new JS file with the script above and call that JS in your HTML?
Yes and call it in html file
How does this answer the question?
What you need to do is put the script <script type="text/javascript"> function ViewItem() { this function calls sucess function or failure function } function success() { } function failed(sender, args) { } </script> in a seperate file let's say "myscript.js" Then on your HTML page call both script files like this: <script src="sp.js"></script> <script src="myscript.js"></script>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.