未捕获的语法错误:意外的令牌}

时间:2013-10-08 19:51:14

标签: javascript jquery html syntax-error

是的,这是Chrome的控制台错误,只需点击一下按钮就会弹出。我认为这些错误是在标记的基础上发生的,但后来这很麻烦,因为加载页面时应该直接出现标记错误,但单击按钮会出现此错误。

以下是此问题的重要 HTML:

<div class="container-fluid">
    <script>
        var offers = <? php echo PostOffer::GetOffers($_GET["id"]); ?> ;
        for (var i = 0; i < offers.length; i++) {
            var date = offers[i].Date.split(" ");
            document.write('<div class="row-fluid offer">' +
                '<div class="span2">' +
                '<img class="profile_picture" src="' + offers[i].Picture_Path + '" />' +
                '</div>' +
                '<div class="span10">' +
                '<div class="row-fluid">' +
                '<div class="username">' +
                '<p style="font-weight: bold;">' + offers[i].Name + '</p>' +
                '</div>' +
                '</div>' +
                '<div class="row-fluid">' +
                '<div class="content">' +
                '<p class="content">' + offers[i].Text + '</p>' +
                '<textarea class="hide span12" id="edited_content">' + offers[i].Text + '</textarea>' +
                '<button type="button" class="hide btn btn-primary btn-small" id="save_edits" onclick="editPostOffer("<?php echo $_GET["id"]; ?>", ' + offers[i].Offer_ID + ', "aaaaaaaaa")">Save Edits</button>&nbsp;' +
                '<button type="button" class="hide btn btn-primary btn-small cancel_edits">Cancel Edits</button>' +
                '</div>' +
                '</div>' +
                '<div class="row-fluid">' +
                '<div class="date">' +
                '<p class="pull-right"><strong><span class="muted">Offered on: </span></strong>' + date[0] + '</p>' +
                '</div>');
            if (offers[i].Username == "<?php echo $_SESSION["
            username "]; ?>") {
                document.write('<div class="controls pull-right">' +
                    '<a href="" class="no_link edit_offer">Edit</a>&nbsp;' +
                    '<a href="" class="no_link" onclick="showDeleteOfferModal(' + offers[i].Offer_ID + ');">Delete</a> |&nbsp;' +
                    '</div>');
            }
            document.write('</div>' +
                '</div>' +
                '</div>' +
                '<hr />');
        }
    </script>
</div>

JS:

$.post("admin/post_offer/edit_post_offer.php", { id: offer_id, text: edited_content }, function (data) {
    if (data.status == "success") {
        console.log("A");
    }
}, 'json');

你能告诉我为什么会这样吗?

0 个答案:

没有答案