Syntax Error Jquery AJAX calling



我得到这个语法错误,因为我错过了一个}可以有人告诉我我可能忽略了什么…这里显示的是第25行,但是我没有看到。

误差

SyntaxError: missing } after property list

代码
$(document).ready(function(){
    // What happens when a user hits the "Accept" button on the dealer form
    $(".label_accept").click(function(){
        $('#LabelMaker').modal('hide');
    });
    $('#labelForm').on('submit', function(e){
        e.preventDefault();
        alert($(this).serialize());
        $.ajax({
        // the location of the CFC to run
        url: "index_proxy.cfm",
        // send a GET HTTP operation
        type: "get",
        // tell jQuery we're getting JSON back
        dataType: "json",
        // send the data to the CFC
        data: $('#labelForm').serialize(),
        // this gets the data returned on success
        success: function (data){
            console.log(data);
        }
        // this runs if an error
        error: function (xhr, textStatus, errorThrown){
        // show error
        console.log(errorThrown);
        }
   });
});

您漏了一个逗号,然后是一个结束块。检查缺少注释的行。

$(document).ready(function () {
    // What happens when a user hits the "Accept" button on the dealer form
    $(".label_accept").click(function () {
        $('#LabelMaker').modal('hide');
    });
    $('#labelForm').on('submit', function (e) {
        e.preventDefault();
        alert($(this).serialize());
        $.ajax({
            // the location of the CFC to run
            url: "index_proxy.cfm",
            // send a GET HTTP operation
            type: "get",
            // tell jQuery we're getting JSON back
            dataType: "json",
            // send the data to the CFC
            data: $('#labelForm').serialize(),
            // this gets the data returned on success
            success: function (data) {
                console.log(data);
            }, // missing comma
            // this runs if an error
            error: function (xhr, textStatus, errorThrown) {
                // show error
                console.log(errorThrown);
            }
        });
    });
}); // missing close block

success处理程序函数之后缺少逗号(,):

success: function (data){
    console.log(data);
}, // < here
error: function (xhr, textStatus, errorThrown) {
    console.log(errorThrown);
}

最新更新