[英]SPServices will not load
In the heading of my page, I have: 在页面的标题中,我有:
<script>
function insureSPServices(callbackFunction)
{
if($().SPServices == null)
{
jQuery.getScript("./scripts/jquery.SPServices-2014.01.js", callbackFunction);
} else {
callbackFunction.call(null, "Already Loaded");
}
}
function populate()
{
alert("SPServices loaded? " + (jQuery.SPServices == undefined ? "NO!!!" : "YES."));
}
</script>
<script type="text/javascript" language="javascript">
$(document).ready(function()
{
alert("jQuery");
alert("!" + $().SPServices.SPGetCurrentSite() + "!");
alert("jQuery loaded? " + (jQuery == undefined ? "NO!!!" : "YES."));
alert("SPServices loaded? " + (jQuery.SPServices == undefined ? "NO!!!" : "YES."
));
insureSPServices(populate());
});
</script>
I get: JQuery YES SPServices NO!!! 我得到: jQuery是SPServices否! SPServices NO!!!
SPServices没有!!!
Notes: The two script paths are legitimate. 注意:这两个脚本路径是合法的。
The SPServices script was downloaded from: http://spservices.codeplex.com/downloads/get/786994 可从以下网站下载SPServices脚本: http : //spservices.codeplex.com/downloads/get/786994
The check/init logic is from here: http://devspoint.wordpress.com/2011/01/07/quick-way-to-load-spservices/ 检查/初始化逻辑来自此处: http : //devspoint.wordpress.com/2011/01/07/quick-way-to-load-spservices/
All help appreciated. 所有帮助表示赞赏。
There might be several problems: 可能有几个问题:
I also stuck with this problem for couple of hours. 我也坚持了几个小时。 For me the answer was to use jQuery.noConflict() in jQuery declaration.
对我来说,答案是在jQuery声明中使用jQuery.noConflict()。 Like this:
像这样:
<script src="../../myLib/jquery-1.11.3.min.js" type="text/javascript">
jQuery.noConflict();
</script>
When using jQuery within SharePoint Web Part try to use jQuery.noConflict() . 在SharePoint Web部件中使用jQuery时,请尝试使用jQuery.noConflict() 。 In many cases there are issues using
$
or jQuery
because of the already loaded jQuery within SharePoint. 在许多情况下,由于SharePoint中已经加载了jQuery,因此使用
$
或jQuery
出现问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.