very strange sharepoint designer file save issue

Jan 13 at 4:46 PM
Edited Jan 13 at 4:46 PM
We have few files that has a javascript function like below. If file has this function sharepoint designer does not let us save the file to style library. If I remove the function save works.

$(xData.responseXML).SPFilterNode("z:row").each(function() {
var link = new spLink($(this));
$('div#links div.items').append(link.html);
});

Above lines if I remove from the function designer is saving this html file.

function addLinks(){
$().SPServices({
operation: "GetListItems",
async: true,
listName: listNameB,
CAMLQuery: "<Query><OrderBy><FieldRef Name='URL' Ascending='True' /></OrderBy></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var link = new spLink($(this));
$('div#links div.items').append(link.html);
});
}
});
}


we also get "
Refused to set unsafe header Connection/Content-length" in chrome when we do same file upload via drag drop.

Other files get uploaded quickly without this function. All the files have 20 to 30 kb file size.
Jan 13 at 6:45 PM
now if I modify above function to

$(xData.responseXML).find("z\:row, row").each(function()
                            {
                                                            var link = new spLink($(this));
                                                            $('div#links div.items').append(link.html);
                                            });
                            }
it lets me save file in sharepoint designer.. no idea whats wrong with

$(xData.responseXML).SPFilterNode("z:row").each(function() {
Coordinator
Jan 13 at 7:15 PM
SharePoint Designer shouldn't care what is in your .js file, so I have no idea what is happening. My guess is that you are trying to put the JavaScript inline in the page and you haven't enclosed it in <script> tags?

M.