2

After putting a small script together and pasting it into the Content Editor Web part all my breakpoints show the following warning in IE 8's debugger: "The breakpoint is not valid. No executable code is associated with this line".

I realize that the CEWP is not the most ideal environment for executing JavaScript. Generally linked files are better however this same issue has occurred even when I have linked the CEWP to a script file. The script is as follows:

<script language="javascript" src="/code_lib/excanvas.js" type="text/javascript"></script>
<script type="text/javascript"> if (!window.console) console = {log: function() {}}; </script>
<script language="javascript" src="/code_lib/jquery-1.7.2.js" type="text/javascript"></script>
<script language="javascript" src="/code_lib/jquery.jqplot.min.js" type="text/javascript"></script>
<script language="javascript" src="/code_lib/plugins/jqplot.barRenderer.min.js" type="text/javascript"></script>
<script language="javascript" src="/code_lib/plugins/jqplot.categoryAxisRenderer.min.js" type="text/javascript"></script>
<script language="javascript" src="/code_lib/plugins/jqplot.pointLabels.min.js" type="text/javascript"></script>
<link href="/code_lib/jquery.jqplot.css" rel="stylesheet" type="text/css"/>
<script language="javascript" src="/code_lib/json2.js" type="text/javascript"></script><script language="javascript" type="text/javascript">

$(document).ready(function(){
var stringURL = https://mydomain.com/Sandbox/bitest/_vti_bin/ListData.svc/Produce 

$.getJSON(stringURL, function(data){
    quantityOneArray=[];
        $(data).find("z\\:row").each(function(i, result) {
            quantityOneArray[i] = parseFloat($(this).attr("ows_Quantity"));
        });
    });

});
</script>

It's possible that I messed up the syntax in my code or made another obvious error.

I am linking in many JavaScript libraries to ultimately create a chart with the pulled JSON data. This script is designed to run in IE7 hence the JSON2 call and the console script in the head.

1 Answer 1

4

you need to place quotes around the url and a semicolon: var stringURL = "http://mydomain.com/Sandbox/bitest/_vti_bin/ListData.svc/Produce";

3
  • Any advice on a good IDE to develop JavaScript in? I find I constantly make simple mistakes like this because I am using NotePad++. It's a great tool, but it doesn't catch syntax errors as I make them. It may be that I'm green, but visual web developer 2010 doesn't seem to work very well and I can't quite understand how to make a simple script in Eclipse without creating some monstrous new project.
    – Shrout1
    Commented Aug 27, 2012 at 17:30
  • Generally I just use visual studio, that catches some stuff, but usually I just try to be careful and use chrome when doing javascript stuff. In Chrome the javascript errors are much more useful and you can edit actively. Commented Aug 27, 2012 at 17:49
  • I recommend visual studio as well. You can make your files open in VS by default within SharePoint designer if you right-click and use "open with program..." before selecting "Visual Studio version selector".
    – Dinerdo
    Commented Jan 26, 2017 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.