0

Why do i get this error:

Uncaught SyntaxError: Unexpected token

error on line 25.

$('form.ajax').on('submit', function() {
    var that = $(this),
        url = that.attr('action'),
        type = that.attr('method'),
        id = that.attr('id'),
        data = {};

    that.find('[name]').each(function(index, value) {   
        var that = $(this),
            name = that.attr('name'),
            value = that.val();

        data[name] = value; 
    });

    $.ajax({    
        url: url,
        type: type,
        id: id,
        data: data,
        error: function(response){
        $(document).ready(function() { $("div").append("<div id='error'>Error</div>"); });
        },
        success: function(response) {
            //Error on this line -> //   $(".comContainer " + id +   ).load(location.href+" .comContainer " + id + ">*","");
        }   
    });


    return false;
});

is it something wrong here? i can't see it

here is the html code to get the code:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>

1 Answer 1

2

You have an extra +:

$(".comContainer " + id +   )

should be

$(".comContainer " + id)
Sign up to request clarification or add additional context in comments.

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.