0

为什么我会收到此错误:

未捕获的 SyntaxError:意外的令牌

第 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;
});

这里有什么问题吗?我看不到

这是获取代码的html代码:

<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>
4

1 回答 1

2

你有一个额外的+

$(".comContainer " + id +   )

应该

$(".comContainer " + id)
于 2013-03-13T23:00:34.987 回答