The JSRequest class is a JavaScript object that lives on all SharePoint Pages, and allows us to simply and quickly get query string values using JavaScript.
It has 3 fields: QueryString, FileName, and PathName.
- QueryString - is an array of key\value pairs representing the current query string parameters.
- FileName - is a string containing the current name of the current page.
- PathName - is the server relative path of the current page.
//First we must call the EnsureSetup method JSRequest.EnsureSetup(); //Get a query string parameter called Id. i.e - "page.aspx?Id=11" will return 11 itemId = JSRequest.QueryString["Id"]; //Get the current page name. i.e - "default.aspx" itemId = JSRequest.FileName; //Get the current path name. i.e - "/itaysk/doclib/default.aspx" itemId = JSRequest.PathName;
Ref: http://blogs.microsoft.co.il/blogs/itaysk/archive/2008/11/30/getting-query-string-parameters-with-javascript-in-sharepoint.aspx
https://www.nothingbutsharepoint.com/sites/devwiki/SP2007Dev/Pages/SharePoint%20JavaScript%20Functions%20Overview.aspx
0 comments:
Post a Comment