【问题标题】:SP Services - Cross Browser IssuesSP 服务 - 跨浏览器问题
【发布时间】:2014-02-12 11:03:59
【问题描述】:

此代码在 Firefox 中完美运行,但在 IE 8.0 中运行时未定义 userPerm。

<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>

编辑:

这是我在打印时从 I.E 得到的响应

xData.responseText

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

但是在 Firefox 中:

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

当我在两个浏览器中直接访问该页面时,我拥有完全访问权限...

编辑 2:

刚刚找到这个:

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

编辑 3

提琴手响应:

Result Protocol Host URL Body Caching Content-Type Process Comments Custom

1 200 HTTP sp-coll-bbs.our-company-ag.com /sites/000057/PropertyandSite/HealthSafety/Assets/SitRight.aspx 23,698 私有,max-age=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 私有,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 私有,max-age=0 文本/xml; charset=utf-8 iexplore:6064
10 302 HTTP sp-coll-bbs.our-company-ag.com /_vti_bin/usergroup.asmx 175 私有,max-age=0 iexplore:6064
11 200 HTTP sp-coll-bbs.our-company-ag.com /_layouts/AccessDenied.aspx 3,821 私人文本/html; charset=utf-8 iexplore:6064

【问题讨论】:

    标签: jquery xml web-services spservices


    【解决方案1】:

    您是否尝试过指定 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

    另外 - 为什么你有两份 $(document).ready()?您应该可以删除内部的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-25
      • 2013-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-12
      • 2013-01-19
      相关资源
      最近更新 更多