1

是的,这是一个 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');

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

4

0 回答 0