0

I am getting this syntax error because I am missing an } can someone please tell me what I may be overlooking... this says line 25 but I do not see it.

Error

SyntaxError: missing } after property list

Code

$(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);
        }
   });
});

2 Answers 2

4

You missed a comma and then a closing block. Check the lines where I've commented as missing.

$(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
Sign up to request clarification or add additional context in comments.

2 Comments

@Vicki I'm checking it out.
@Vicki Can you show the output of the AJAX call by checking the Console Tab of your F12 Dev Tools?
2

You're missing a comma (,) after the success handler function:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.