SharePoint - Creating a Rotating Image Banner using JavaScript
Build a rotating image banner in SharePoint 2013 by reading a picture library with REST and swapping an img tag every 5 seconds.
Tag
Build a rotating image banner in SharePoint 2013 by reading a picture library with REST and swapping an img tag every 5 seconds.
Read items from a SharePoint 2013 list with the REST API and jQuery, selecting only the fields you need.
var siteUrl = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl;
jQuery.ajax({
url: siteUrl + "/_api/lists/getbytitle('ListTitle')/Items?$select=Title",
type: "GET",
headers: {Use jQuery in a Script Editor web part to make list item links open the edit form instead of the display form.
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
// Change all display form links to edit form links
$('.ms-vb a[href*="listform.aspx"]').each(function(){Update custom profile properties as a non-admin user in SharePoint Online by calling the old user profile web service through SPServices.
Escape single and double quotes in a string before an AJAX post, using a simple replace instead of encoding everything.
data.replace(/(['"])/g, "\\$1")Look the function up on window using its name, check it is a function, then call it with apply.
var functiontocall = "HelloWorld";
var fn = window[functiontocall];
if (typeof fn !== 'function')
return;
var retvalue = fn.apply(window, ["Amal Hashim"]);Two small functions that encode and decode HTML characters by letting jQuery and the browser do the work.
Run code when a popup window opened with window.open is closed, using the onbeforeunload event.
var popupWindow = window.open(url);
popupWindow.onbeforeunload = function() {
//Do processing
return null;A simple XOR based encrypt and decrypt routine in JavaScript, for demonstration only.
function Encrypt()
{
var actual = "stringtoencrypt";
var key = 100; //Any integer value
var result = "";
for (var i = 0; i < actual.length; i++)Build a cascading dropdown in ASP.NET with jQuery and a page method: pick an author and the books drop down fills in.
A generic JavaScript function to capture a key press and run logic, such as clearing a field on backspace.
function CheckKey(e) {
var keynum;
if (window.event) // IE
{
keynum = e.keyCode;
}Steps to add a jQuery UI autocomplete (type ahead) box to an ASP.NET page, backed by a WCF data service.