2014-02-12 86 views
0

此代码在Firefox中完美工作,但在I.E 8.0中运行它时userPerm未得到定义。SP服务 - 跨浏览器问题

<script type="text/javascript"> 
$(document).ready(function() { 

$(document).ready(function() { 

$().SPServices({ 
operation: "GetRolesAndPermissionsForCurrentUser", 
async: false, 

completefunc: function(xData, Status) { 

alert(xData.responseXML.xml); 

var userPerm = $(xData.responseXML).SPFilterNode("Permissions").attr("Value"); 
    alert("userPerm = " + userPerm); 
    var nonAdminP = (33554432 & userPerm) == 33554432; 
    alert("Non Admin Permissions == 33554432: " + nonAdminP); 
    var adminP = userPerm == 9223372036854775807; 
    alert("Admin Permissions: " + adminP); 




} 
}); 

}); 

}); 
</script> 

编辑:

这是我从即得到响应在Firefox打印

xData.responseText时

http://i60.tinypic.com/33ufnt3.png

但是:

http://i62.tinypic.com/205rid.png

当我直接访问该页面在两个浏览器我有充分的机会......

编辑2:

刚刚发现这一点:

http://support.microsoft.com/kb/896861

编辑3

提琴手回应:

结果P rotocol主机URL正文缓存内容类型处理注释自定义

1 200 HTTP sp-coll-bbs.our-company-ag.com /sites/000057/PropertyandSite/HealthSafety/Assets/SitRight.aspx 23,698 private,max-年龄= 0;到期时间:2014年1月29日星期三08:00:51 GMT text/html; charset = utf-8 iexplore:6064
2 304 HTTP sp-coll-bbs.our-company-ag.com /sites/000057/SiteAssets/title.css 0 private,max-age = 0;到期时间:周一,2014年1月29日08:00:52 GMT iexplore:6064
3 200 HTTP code.jquery.com /jquery-1.9.1.js 268,503 max-age = 315360000;到期时间:2037年12月31日星期四23:55:55 GMT application/x-javascript; charset = utf-8 iexplore:6064
4 304 HTTP sp-coll-bbs.our-company-ag.com /sites/000057/SiteAssets/CP%20Information%20Page%20Icons/60-pandSS.png 0 private,max -age = 0;到期时间:周一,2014年1月29日08:00:52 GMT iexplore:6064
5 200 HTTP code.jquery.com /ui/1.10.4/jquery-ui.js 436,883 max-age = 315360000;到期时间:2037年12月31日星期四23:55:55 GMT application/x-javascript; charset = utf-8 iexplore:6064
6 200 HTTP code.jquery.com /ui/1.10.4/themes/smoothness/jquery-ui.css 32,042 max-age = 315360000;到期时间:2037年12月31日星期四23:55:55 GMT text/css iexplore:6064
7 304 HTTP sp-coll-bbs.our-company-ag.com /sites/000057/SiteAssets/jquery.SPServices-0.7。 0.min.js 0 private,max-age = 0;到期时间:2014年1月29日星期三08:00:52 GMT iexplore:6064
8 304 HTTP sp-coll-bbs.our-company-ag.com /sites/000057/SiteAssets/default/CP_small.PNG 0 private,max -age = 0;到期时间:2014年1月29日星期三08:00:52 GMT iexplore:6064
9 200 HTTP sp-coll-bbs.our-company-ag.com /_vti_bin/Webs.asmx 380 private,max-age = 0 text/XML; charset = utf-8 iexplore:6064
10 302 HTTP sp-coll-bbs.our-company-ag.com /_vti_bin/usergroup.asmx 175 private,max-age = 0 iexplore:6064
11 200 HTTP sp- coll-bbs.our-company-ag.com/_layouts/AccessDenied。aspx 3,821 private text/html; charset = utf-8 iexplore:6064

回答

0

您是否试过指定webURL参数(在您的async参数之前)并指定您的站点的完全限定的域名或您的内容的相对路径?

$().SPServices({ 
    operation: "operationname", 
    webURL: "/sitepath", // <-- right here 
    async: false, 
    completefunc: function (xData, Status) { 
     ...do stuff... 
    } 
}); 

(语法参考:http://spservices.codeplex.com/wikipage?title=%24().SPServices

而且 - 为什么你有$(文件)。就绪()的两个副本?你应该能够删除内在的一个。