SPScriptAudit Implementation Question

Coordinator
Dec 30, 2009 at 4:46 PM

From Tasha:

Good Morning Marc,
Not to be dumb right out of the gate, but what is the best way to implement this? I added the following code under "PlaceHolderMain" using SPDesigner:
<script type="text/javascript" language="javascript" src="/jQuery/jquery.SPServices-0.4.8ALPHA2.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$().SPServices.SPScriptAudit({
webURL: "http://vpintranettemp/sandbox/Advertising",
outputId: "MyOutput",
showSrc: true
});
</script>
<div id="MyOutput"></div>
No error is generated but nothing shows up on the page. Do I need to build the list for it to populate?
As always, thanks for your patience,
Tasha

I don't like to assume, so are you also loading the jQuery library up front?

M.

Dec 30, 2009 at 4:54 PM

You know what they say about assuming! ;-) --So i'm going to say up front that I am not sure what you mean.

I have downloaded the newest jQuery library as you instructed and loaded it into my jQuery document library stored in my site collection.

Is that what you mean?

Coordinator
Dec 30, 2009 at 5:00 PM

What I mean is that you also need to reference the jQuery library first. Assuming you have it stored in the same place, it would look like this:

<script type="text/javascript" language="javascript" src="/jQuery/jquery.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/jQuery/jquery.SPServices-0.4.8ALPHA2.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
    $().SPServices.SPScriptAudit({
      webURL: "http://vpintranettemp/sandbox/Advertising",
      outputId: "MyOutput",
      showSrc: true
    });
});
</script> <div id="MyOutput"></div>
Oh, and I just noticed that you are missing the closing "});". I find that indenting is always a good idea to avoid missing things like that. I'm surprised you didn't get a JavaScript error.
You *may* need to put the DIV into a Content Editor Web Part, though the jQujery should find it where you've got it.

M.

Coordinator
Dec 31, 2009 at 8:00 PM

Did you try the "Hi Tasha" trick to be sure that the references are correct?

<script type="text/javascript" language="javascript" src="/jQuery/jquery.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/jQuery/jquery.SPServices-0.4.8ALPHA2.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
    alert("Hi Tasha!");
    $().SPServices.SPScriptAudit({
      webURL: "http://vpintranettemp/sandbox/Advertising",
      outputId: "MyOutput",
      showSrc: true
    });
  });
</script>
<div id="MyOutput"></div>

If all of the above is in a CEWP, it ought to be working, assuming that the two js files are in http://servername/jQuery.

M.

Dec 31, 2009 at 8:48 PM

YAY!!! It worked this time! I guess for whatever reason it did not like how i sourced the two js files. I put the whole location name in there and viola!

As always, you are my hero. ^_^ Happy New Year!