user3001408
user3001408

Reputation: 310

Uncaught Reference Error: Unexpected Token }

<script type="text/javascript">
    $(function () {
    var plot = $.plot($("#content"), [{
        color: '#6B6B84',
        label: 'normal one',
        data: [
            [
                [10, 0],
                [13, 5]
            ]
        ]
    }, {
        color: '23641E',
        label: 'modified',
        data:
    }], {
        xaxis: {
            mode: "time",
            timeformat: "%d/%m/%y"
        },
        grid: {
            hoverable: true,
            autoHighlight: true
        }
    });
});
</script>

The above code is showing "Uncaught Reference Error: Unexpected Token }" in Chrome. I have defined a div element with id=content. The above code is to draw graph using "Flot". Would greatly appreciate you guyz help here! I am using django here.

Upvotes: 0

Views: 245

Answers (1)

Chris Cherry
Chris Cherry

Reputation: 28554

I've reformatted your code to make it easier to read. You can now see the second data: element has no value, which is the source of your error.

$(function() {
    var plot = $.plot($("#content"), [
        { 
            color:'#6B6B84',
            label:'normal one',
            data: [
                [[10, 0], [13, 5]]
            ]
        },
        {
            color:'23641E',
            label: 'modified',
            data: 
        }
    ], 
    {
        xaxis: {
            mode:"time",
            timeformat: "%d/%m/%y"
        },
        grid: {
            hoverable: true,
            autoHighlight: true
        }
    }
    );
});

Upvotes: 3

Related Questions