Step 1: Kindly follow my intital post to understand how java script can be used in Content Editor Web Part.
Step 2: Consider the SharePointSite has a URL like
http://sample.com/sites/basicJs/Pages/NewPage.aspx?Source=http://sample.com/sites/basicJs/Default.aspx&MyQueryString=KeyWords
Step 3:To obtain the values of the Querystring like "Source" and "MyQueryString" SPServices comes in very handy.
Within Content Editor Web Part insert this code
<html>
<head>
<SCRIPT type=text/javascript src="/mysites/myDocLibrary/JsFiles/jquery-1.4.2.min.js"></SCRIPT>
<SCRIPT type=text/javascript src="/mysites/myDocLibrary/JsFiles/JsFiles/jquery.SPServices-0.5.6.min.js"></SCRIPT>
<SCRIPT type=text/javascript>
var queryStringVals = $().SPServices.SPGetQueryString();
var thisSource = queryStringVals["Source"];
var thisQStr = queryStringVals["MyQueryString"];
document.write("Source is " + thisSource );
document.write("MyQueryString is " + thisQStr);
</SCRIPT>
</head>
<Body>
</Body>
</html>
Step 4 : To remove the identity that the code was generated from Content Editor Web Part, within the Web Part Setting, Under Appearance, For Chrome Type select "None". Click OK. Click Apply. Publish the Page.
Step 5: To build dynamic URLs using the same approach, kindly follow my previous post.
Leave your comments below.
1 comment:
Hi i wanted to know how o fetch the MyQueryString dynamically I have a list in which i am with the help of SpServices i am fetch all the data and displaying it now when i click of a particular TITLE That TITLE details should only be displayed how to achieve that right now you have passed the &"MyQueryString=KeyWords" is static but how to give this keyword dynamically
Please help it is urgent
Post a Comment