This project has moved. For the latest updates, please go here.

Calling function

Sep 16, 2010 at 9:28 AM

Hi ,

I have the following script:

// Reference jquery and spservices javascript libraries
<script src="/Lists/Site%20Code/Attachments/20/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="/Lists/Site%20Code/Attachments/27/jquery.SPServices-0.5.6.min.js" type="text/javascript"></script>

<script type="text/javascript"> 

// When the document (html page) has loaded this jquery function runs

// Run SPServices fucntion to access SharePoint List Items
// set operation required - see spservices documentation for all types of possible operations
  operation: "GetListItems",
// identify list name to get items from
  listName: "Test1",
// setup CAML request - This is used to define what is reqested and sent back to us from the server
  CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Column2' /><FieldRef Name='Column3' /></ViewFields>",
// When the operation has completed, run the following function
  completefunc: function (xData, Status) {
// display an alert message box with the xml content that was received from the server by our CAML request
// From XML, find z:row and go through each z:row
      $(xData.responseXML).find("z\\:row").each(function() {
// In the body div with id=output, append the concatenated string - the row's attribute 'ows_title' + ':' + the row's attribute 'column2' +
// '-' + the row's attribute 'ows_column3
         $("#output").append($(this).attr("ows_Title") + " : " + $(this).attr("ows_Column2") + " - " + $(this).attr("ows_Column3")+ "<br />");

// In the body select with id=myselect, append the concatenated string - '<option>' + the row's attribute 'ows_title' + '</option>'
$("#mySelect").append("<option>" + $(this).attr("ows_Title") + "</option>");


<div id="output"></div>

<select id="mySelect">

I need to set the function above seperatly, and be able to call it from completefunc: by the function name.

Any help?


Sep 16, 2010 at 11:22 AM
I'm not sure I understand your question. Could you explain more? M.