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!!! SPServices NO!!!
Notes: The two script paths are legitimate.
The SPServices script was downloaded from: 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/
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. 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() . In many cases there are issues using $
or jQuery
because of the already loaded jQuery within SharePoint.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.