0

I'm trying to code using JSOM, I've done this in SPD and added a master page to a blank aspx page (spd). However I don't want to see the ribbon and also want to launch the page in a dialog box. Hence decided to try without the master page however the code doesn't work. There are numerous sites explaining adding scriptlink/SOD but can't get this to work. Here is the code of a blank aspx page created in SPD, Could someone suggest what code needs adding and where please?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Page Language="C#" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
</head>

<body>

<form id="form1" runat="server">
</form>

</body>

</html>

I want to execute code that retrieves items from a list as described here https://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx

1 Answer 1

1
     Add Following JS references to your blank page: i.e 
1. MicrosoftAjax.js
2. sp.runtime.js
3. sp.js

    <script type="text/javascript" src="../SiteAssets/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="../SiteAssets/sp.runtime.js"></script>
    <script type="text/javascript" src="../SiteAssets/sp.js"></script>
3
  • Here is the hyperlink i found while doing some google - aviralchawda.blogspot.in Commented May 11, 2015 at 11:05
  • Hi Seems to work but another error down the line.. var clientContext = new SP.ClientContext.get_current(); Does not work, it requires a relative url. Can I get the current site at runtime? Commented May 11, 2015 at 11:55
  • I am not sure about that but You can provide site collection URL directly in ClientContext .......Try follwing line and check if it is working ---> var clientContext = new SP.ClientContext('http://..........'); Commented May 11, 2015 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.