1

I am brand new to using JavaScript/Jquery, but I am attempting to make an HTML Index file which will be saved onto my SharePoint that neatly displays items from a Sharepoint list on the page...

Can anyone explain the basics of using Jquery to me or suggest a good video tutorial for what I want to achieve? Below is some of the code that I have put together based on what I have read.

<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">

/* Tested with WSS3,IE9,FF19 */

$(document).ready( function() {

    var siteUrl = "https://ishareteam4.na.xom.com/sites/chembtcp14/Lists/Starter Links/AllItems.aspx ",
        listId  = "{5BCD4785-6882-4FD4-8402-686DEB10F701}";

$.get( siteUrl + "/_vti_bin/owssvr.dll?Cmd=Display&XMLDATA=TRUE&List=" + listId, 
    function( xml ) {
        var zrow = xml.getElementsByTagName("z:row");
        for(var i=0; i<zrow.length; i++) {
            $("#table1 tbody").append( 
            "<tr><td>"
            + zrow[i].getAttribute("ows_Title")
            + "</td><td>"
            + zrow[i].getAttribute("ows_Description") 
            + "</td><td>" 
            + zrow[i].getAttribute("ows_URL") 
            + "</td></tr>" 
            );
        }
});
});

</script>

<table id="table1">
<caption>Starter Links</caption>
<tbody></tbody>
</table>

</body>
</html>
  • Refer this: c-sharpcorner.com/UploadFile/sagarp/… – Ankit Katiyar Jan 30 at 3:19
  • Which Sharepoint version are you using, a comment in your code refers to WSS3 which is rather obsolete. Also, the siteUrl parameter is probably wrong as it points to a list view page instead of a site. Should probably be "https://ishareteam4.na.xom.com/sites/chembtcp14". – Steve T Feb 2 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.