Is it “jquery.SPServices-0.6.1.min.js” and “SPAPI_Lists.js” compatible with SharePoint 2010?

Jun 17, 2011 at 12:16 AM
Edited Jun 17, 2011 at 12:17 AM

Is it "jquery.SPServices-0.6.1.min.js" and "SPAPI_Lists.js" may not work with SharePoint 2010.

It is working perfectly on IE but failing on Firefox4.0.. is there any compatibility issue?

Below is the script snippet

$().SPServices({

                                    operation: "Query", 
                                    async: false,
                                    queryXml: queryText, 

                                    completefunc: function(xData, Status) { 

                                        $(xData.responseXML).find("QueryResult").each(function() { 

                                            //let's see what the response looks like 

                                            var  result =  $(this).text();

                        var  url, author, dateRange, series, format = "";

                        if (window.DOMParser)
                        {
                          parser=new DOMParser();
                          xmlDoc=parser.parseFromString(result,"text/xml");
                        }
                        else // Internet Explorer
                        {
                          xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
                          xmlDoc.async="false";
                          xmlDoc.loadXML(result);
                        }
var resultCount = xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(1).text;
                            //xmlDoc.childNodes(0).firstChild.childNodes(0) -> Range
                            //xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes(0) -> Results
                            //xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes(loopcount).childNodes(1).childNodes -> Indi Results
                            //childNodes.length

                            //alert(xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes(0).firstChild.childNodes(0).text);
                            for( var loopcount = 0; loopcount < xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes.length; loopcount++)
                            {
                                var indiresult = xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes(loopcount).firstChild.firstChild.text;
                                if ( indiresult.indexOf("PKS Podcasts/DispForm.aspx") > -1) {
                                    format = xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes(loopcount).childNodes(1).childNodes(0).childNodes(2).text;
                                    author = xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes(loopcount).childNodes(1).childNodes(1).childNodes(2).text;
                                    series = xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes(loopcount).childNodes(1).childNodes(2).childNodes(2).text;
                                    dateRange= xmlDoc.childNodes(0).firstChild.childNodes(0).childNodes(3).childNodes(loopcount).childNodes(1).childNodes(3).childNodes(2).text;
                                  

Coordinator
Jun 17, 2011 at 12:21 AM

And what's the error? Obviously, you're handling things differently if you are in IE than in Firefox, so you've got two sets of code to debug.

My guess is that SPServices is working exactly the same in the two browsers. Add the alert I show below and you'll probably see the exactly same thing in each.

M.

$().SPServices({
  operation: "Query",  
  async: false,
  queryXml: queryText,  
  completefunc: function(xData, Status) {
    alert(xData.responseText);
    $(xData.responseXML).find("QueryResult").each(function() {  
        //let's see what the response looks like  
        var  result =  $(this).text();
        var  url, author, dateRange, series, format = "";
        if (window.DOMParser) {
          parser=new DOMParser();
          xmlDoc=parser.parseFromString(result,"text/xml");
        } else {  // Internet Explorer
         xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
         xmlDoc.async="false";
         xmlDoc.loadXML(result); 
       } 
...
Jun 20, 2011 at 3:56 PM

Thank you. It works fine and it was my mistake.

Coordinator
Jun 20, 2011 at 4:03 PM

Good to hear!

M.

Coordinator
Jun 20, 2011 at 4:03 PM

Good to hear!

M.