Thayer
Thayer

Reputation: 5

Uncaught SyntaxError: Unexpected token jquery

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>

Upvotes: 0

Views: 5373

Answers (1)

Mark Parnell
Mark Parnell

Reputation: 9200

You have an extra +:

$(".comContainer " + id +   )

should be

$(".comContainer " + id)

Upvotes: 2

Related Questions