Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Strange behavior when testing script references

$
0
0
Hi, following the guide at http://sympmarc.com/2011/07/08/adding-jqueryspservices-to-a-sharepoint-page-step-one-always/, I've added the below code to my page. Ctrl+Clicking the script references works fine. When I try it on the page, the first SPGetCurrentSite() alert works fine. The second SPGetCurrentSite() alert inside the document.ready function gives the following error:

"Unable to get value of the property 'SPGetCurrentSite': object is null or undefined"

Why is it working outside of the document.ready function, but not inside?
<script type="text/javascript" src="/JQuery/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/JQuery/jquery.SPServices-0.7.2.min.js"></script>

<script type="text/javascript">
alert($().SPServices.SPGetCurrentSite());

$(document).ready(function() {
alert("jQuery");
alert($().SPServices.SPGetCurrentSite());
  });
</script>

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>