code: function(options) {
  
              var opt = $.extend({}, {
                  listName: "", // The list the form is working with. This is useful if the form is not in the list context.
                  thisUserId: "" // The current user's id in the site Collection.
              }, options);
  
              // The SharePoint variables only give us a relative path. to match the result from WebUrlFromPageUrl, we need to add the protocol, host, and (if present) port.
              var siteRoot = location.protocol + "//" + location.host; // + (location.port !== "" ? location.port : "");
  
              var thisContext = {};
              // SharePoint 2010+ gives us a context variable
              if (typeof _spPageContextInfo !== "undefined") {
                  thisContext.thisSite = siteRoot + _spPageContextInfo.webServerRelativeUrl;
                  thisContext.thisList = opt.listName ? opt.listName : _spPageContextInfo.pageListId;
                  thisContext.thisUserId = opt.thisUserId ? opt.thisUserId : _spPageContextInfo.userId;
                  // In SharePoint 2007, we know the UserID only
              } else {
                  thisContext.thisSite = (typeof L_Menu_BaseUrl !== "undefined") ? siteRoot + L_Menu_BaseUrl : "";
                  thisContext.thisList = opt.listName ? opt.listName : "";
                  thisContext.thisUserId = opt.thisUserId ? opt.thisUserId : ((typeof _spUserId !== "undefined") ? _spUserId : undefined);
              }
  
              return thisContext;
  
          }
docs: Get the current context (as much as we can) on startup See: http://johnliu.net/blog/2012/2/3/sharepoint-javascript-current-page-context-info.html