Has anyone got this working in MOSS 2007?

Mar 5, 2012 at 2:27 PM

Hi,

I am using a document library for storing the jQuery and SPServices files. The jQuery is working but apparently the SPServices calls are not working. I'm doing simple tests to see if the calls are made and there is nothing indicating that it is working. I'm wondering if Web Services within MOSS could be turned off? The funny thing is I can access the site with SharePoint Designer 2007 which I think uses web services. Let me know if and how anyone has gotten this to work with MOSS 2007.

Thanks in advance

WW

 

Mar 5, 2012 at 4:45 PM

This works fine in 2007 and it is how we use our jQuery and SPServices. I have not hear of the web services being turned off though. Web services run in the context of the current user. You might want to post some code examples so that it is easier to assist you!

Mar 5, 2012 at 7:50 PM
Edited Mar 5, 2012 at 7:51 PM

Thanks for your reply spevilgenius,

Here is what I am trying to run as a test. If I can get this working, then I do much heavier development with this approach. Take a look and let me know what you think:

$(document).ready(function() {
  $().SPServices({
    operation: "GetListItems",
    async: false,    
    listName: "GiftTypes",
    CAMLViewFields: "<ViewFields><FieldRef Name='Foundation'/></ViewFields>",
    completefunc: function (xData, Status) {
     alert(xData.responseXML);
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Foundation") + "</li>";
        $("#tasksUL").append(liHtml);        
      });
    }
  });
});

As you can see, I am trying to return one field 'Foundation' and I am placing an 
alert to tell me if anything is being passed into the xData variable which obviously
does not work. The error says that an unexpected error has occured and I don't have access
to the ULS logs.
Thanks,
WW
Coordinator
Mar 6, 2012 at 12:58 AM

You won't see any errors in the ULS logs because this is client side script. My guess is that your references to jQuery or SPServices are incorrect.

M.

Mar 6, 2012 at 3:00 AM

Hi Marc,

I actually confirmed the references by using your method of ctrl-click in SPD and it opened the js file. The site uses SSL which I'm thinking may introduce other issues. I'd previously just referenced the minified file and got nothing but once I changed it to the full file, I got the error. Not sure what could be the problem. Any help would be greatly appreciated.

Coordinator
Mar 6, 2012 at 3:16 AM

It shouldn't matter whether you reference the minified or unminified files; the results are the same.

Try adding an alert just after the $(document).ready(). That will tell you if jQuery is loaded.

If that works, then change your existing alert to

alert(xData.responseText);

This will show you what is returned from the call, if anything.

M.

Mar 6, 2012 at 4:02 PM

if you look at the code snippet in my previous post, you will see that I did exactly what you are suggesting. I've already confirmed that jQuery is working but the SPServices calls seem not to be working. using the alert to show the xData.responseText shows nothing with minified and errors with the full file. Looks like I need to keep digging on this one.

 

Thanks

Mar 6, 2012 at 5:44 PM

What you can do is mod your code just a tad:

 

$(document).ready(function() {
alert('jquery loaded');

  $().SPServices({
    operation: "GetListItems",
    async: false,    
    listName: "GiftTypes",
    CAMLViewFields: "<ViewFields><FieldRef Name='Foundation'/></ViewFields>",

 

 

    completefunc: function (xData, Status) {
     alert(xData.responseText);
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Foundation") + "</li>";
        $("#tasksUL").append(liHtml);        
      });
    }
  });
});

That should at least fire the first alert.  If it doesn't, you'll want to open up the web developer tools and see what's gone awry.

 

Mar 7, 2012 at 12:01 AM

OK,

The first alert fires with no problem and the second one does not, but there is a javascript error that says 'Object doesn't support property or method 'SPServices'. Here is how I have my references in my master page:

<script type="text/javascript" src="../GC-Test/Site%20Assets/Scripts/jquery-1.6.2.min.js"/>
<script type="text/javascript" src="../GC-Test/Site%20Assets/Scripts/jquery.SPServices-0.7.1a.js"/> 
<script type="text/javascript" src="../GC-Test/Site%20Assets/Scripts/js/jquery-ui-1.8.16.custom.min.js"/>

Just so you know the master page I'm using is default.master if that makes a difference. I'm wondering if it could be the order of the references or should I get a more recent version of jQuery?

Mar 7, 2012 at 2:12 AM

The error is saying that SPServices is not loaded. Take the URL to SPServices, in your prior post, complete it so that it is the full URL and paste it into the browser address bar. Are you able to load the library?

The order of how jQuery and SPServices is loaded is important, and you have it listed in the correct order.

Paul

Sent from mobile