2014-02-12 85 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

而且 - 爲什麼你有$(文件)。就緒()的兩個副本?你應該能夠刪除內在的一個。