Object doesn't support property or method 'SPFilterNode'

Nov 20, 2012 at 11:37 PM

Hi there,

I am trying to create an index.html file which retrieves data from an external SharePoint List. So, once I open that html file, I would like to see the data from the SharePoint List without opening the site. 

Basically, what I am trying to do is to use the call 'GetListItems' in order to read the data of that SharePoint site trough a JavaScript function which is on my index.html file. This is what I did so far:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">
    </head>

    <body>
		
	<script type="text/javascript" src="filelink/jquery-1.6.1.min.js"></script>
	<script type="text/javascript" src="filelink/jquery.SPServices-0.6.2.min.js"></script>
	<script language="javascript" type="text/javascript">

		$(document).ready(function() {
		  $().SPServices({
			operation: "GetListItems",
			webURL: "http://mysharepointsite/Lists/NASM",
			async: false,
			listName: "NASM",
			CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
			completefunc: function (xData, Status) {
			  $(xData.responseXML).SPFilterNode("z:row").each(function() {
				var liHtml = "
  • " + $(this).attr("ows_Title") + ""; $("#tasksUL").append(liHtml); }); } }); }); </script> <ul id="tasksUL"/> ab </body> </html>
  •  

    Every time that I try to open my index.html on IE9 I get the following error:
    Object doesn't support property or method 'SPFilterNode' index.html, line 25 character 6

    The line which is failing is:  $(xData.responseXML).SPFilterNode("z:row").each(function()

    If I debug that using IE9 debugger, the value of the Status variable (function (xData, Status) ) is error so I don't know how to retrieve the data... actually I am not sure even if I am connecting properly to the SharePoint List (I don't think so)

    Any suggestions?

    Thanks. 

    Nov 21, 2012 at 2:40 AM

    This may be a cross-site issue if the file is not hosted on the sharepoint site. Also, is that the actual URL to the sharepoint site? looks like the link to the lists on the site. Maybe it should be define it as:
    http://mysharepointsite

    The 'Status' variable being at error is telling you that the call to the server failed (probably never left the browser due to the cross site permission issues.)

    Paul

    Sent from mobile

    Coordinator
    Nov 21, 2012 at 4:30 AM

    Also, the SPFilterNode function isn't in SPServices v0.6.2. I introduced it in v0.7.0.

    Paul's right on his points as well.

    M.

    Nov 21, 2012 at 9:48 AM
    Edited Nov 21, 2012 at 1:15 PM

    I tried to use the following js file:

    	<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
    	<script type="text/javascript" src="js/jquery.SPServices-0.7.0.min.js"></script>
    

    But now it is not throwing any exception or error, actually if I put a breakpoint in the JavaScript code nothing happens, so looks like the JavaScript is not executed.

    Could you also give me some suggestions about the cross-site issue?

    EDIT: After more debugging looks like the issue could be related to credential issues? When I try to go to the requested URL I get that: Status Code:401 Unauthorized

    EDIT: It is working. My problem was related to credentials issues, thanks! :)

    Thanks,

    N