Javascript代码中未捕获的SyntaxError:意外的令牌

时间:2013-04-14 09:30:16

标签: javascript jquery syntax-error

为什么我收到此错误:“未捕获的SyntaxError:意外的令牌”“对于下面的代码?

<script>

function dogetfollowers() {

Item = Parse.Object.extend("Profiles");

query = new Parse.Query(Item);

query.limit = 1;
query.ascending('createdAt');
query.equalTo("username", $("#profilename").html());

query.find({
    success: function (results) {

        for (var i = 0; i < results.length; i++) {
            var localfollowers = results[i].get("followers");
            var profilepictures = new Array();

            Item2 = Parse.Object.extend("User");

            query2 = new Parse.Query(Item);

            query2.ascending('createdAt');

            query2.find({
                success: function (results2) {

                    for (var i = 0; i < results2.length; i++) {

                        var name = results2[i].get("username");

                        var index = localfollowers.indexOf(name);

                        if (index != -1) {

                            var ppurl = results2[i].get("profilepicture");
                            profilepictures.push(ppurl);

                        }

                    }

                    for (var i = 0; i < profilepictures.length; i++) {

                        var strVar = "";
                        strVar += "<div id=\"ppparent\" class=\"ppparent\" style = \"left:30px; width: 75px;height:75px;border-radius: 10px;-moz-border-radius: 10px;-khtml-border-radius: 10px;-webkit-border-radius: 10px;position:absolute;overflow:hidden;\">";
                        strVar += "";
                        strVar += "<table width=\"100%\" height=\"100%\" align=\"center\" valign=\"center\">";
                        strVar += "   <tr><td>";
                        strVar += "      <img src=\"";
                        strVar += profilepictures[i];
                        strVar += "\" width=\"75px\" id=\"coverprofilepicture\" class=\"coverprofilepicture\" alt=\"Profile Picture\" style = \"-webkit-transform:scale(1.0);-moz-transform:scale(1.0);-o-transform:scale(1.0);\" \/>";
                        strVar += "   <\/td><\/tr>";
                        strVar += "<\/table>";
                        strVar += "";
                        strVar += "<\/div>";

                        $('#friends').prepend(strVar);

                    }

                },
                error: function (error) {

                }
            });


        }


    },
    error: function (error) {

    }
});

});

</script>

1 个答案:

答案 0 :(得分:3)

脚本的最后一行应为};而不是});